Skip to content

Database Error and More environment variable weirdness in docker-compose #578

Closed
@SinisterCrayon

Description

@SinisterCrayon

I saw this mentioned in another thread, but in the latest builds my Wordpress site is broken. Seems to be the same issue reported by @kunalnagar My docker-compose file (edited to remove passwords and stuff obviously);

version: '3.4'`

services:
  mindfield-wp:
    depends_on:
      - mindfield-db
    image: wordpress:latest
    deploy:
      resources:
        limits:
          memory: 1024M
    environment:
      WORDPRESS_DB_HOST: mindfield-db:3306
      WORDPRESS_DB_USER: wordpress
      WORDPRESS_DB_PASSWORD: wordpress-password
      WORDPRESS_CONFIG_EXTRA: |
        /* Multisite */
        define('WP_ALLOW_MULTISITE', true );
        define('WP_REDIS_HOST', 'redis_host' );
        define('WP_REDIS_DATABASE', '2' );
    links:
      - mindfield-db:mysql
    ports:
      - 30001:80
    volumes:
      - /tmp:/tmp
      - /store/appdata/data/wp-content:/var/www/html/wp-content
      - /store/appdata/data/uploads.ini:/usr/local/etc/php/conf.d/uploads.ini

  mindfield-db:
    image: mariadb
    deploy:
      resources:
        limits:
          memory: 1024M
    environment:
      MYSQL_ROOT_PASSWORD: root-password
      MYSQL_DATABASE: wordpress
      MYSQL_USER: wordpress
      MYSQL_PASSWORD: wordpress-password
    volumes:
      - /store/appdata/db:/var/lib/mysql
      - /tmp:/tmp

When I look at the wp-config.php I'm getting

root@fa79793a21ce:/var/www/html# cat wp-config.php |grep -i db_name
define( 'DB_NAME', getenv_docker('WORDPRESS_DB_NAME', 'database_name_here') );

Clearly it's not carrying over the environment variables from the compose file. Good thing this site's only personal and not production...

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions