Skip to content

Environment variables no longer work in Docker Compose #576

Closed
@siccovansas

Description

@siccovansas

After pulling the latest WordPress Docker image today I end up with a default wp-config.php, resulting in 'Error establishing a database connection' when trying to open my WordPress website.

My wp-config.php doesn't contain the values I specify via environment variables in my docker-compose.yml, which are:

  • WORDPRESS_DB_HOST
  • WORDPRESS_DB_NAME_FILE
  • WORDPRESS_DB_USER_FILE
  • WORDPRESS_DB_PASSWORD_FILE
  • WORDPRESS_CONFIG_EXTRA

My logs show this line:
No 'wp-config.php' found in /var/www/html, but 'WORDPRESS_...' variables supplied; copying 'wp-config-docker.php' (WORDPRESS_CONFIG_EXTRA WORDPRESS_DB_HOST WORDPRESS_DB_NAME_FILE WORDPRESS_DB_PASSWORD_FILE WORDPRESS_DB_USER_FILE)

This seems related to the recent merge of Move "wp-config-docker.php" to non-beta (5.7 GA) #572. As per this comment, I entered my Docker container and removed wp-config.php and restarted the container. A new wp-config.php is generated (giving the same message in my logs as shown above), but this is the same as the previous one and doesn't contain the values from my environment variables.

I guess the new issues #573 and #574 are related.

I pull new WordPress docker images on a daily bases, and this problem hasn't occurred before. So I guess it is not caused on my end.

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