Hello, while testing with the new latest WordPress (5.8) I noticed the environment variables not being parsed correctly resulting in a Error establishing a database connection error.

Steps to Reproduce
- Pull the
wordpress:latest image - Create a
docker-compose.yml file based on the official documentation - Change the environment variables from the WordPress service
version: '3.1'services:
wordpress:
image: wordpress:latestrestart: alwaysports:
- 8080:80environment:
WORDPRESS_DB_HOST: THIS_SHOULD_APPEARWORDPRESS_DB_USER: THIS_SHOULD_APPEARWORDPRESS_DB_PASSWORD: THIS_SHOULD_APPEARWORDPRESS_DB_NAME: THIS_SHOULD_APPEARvolumes:
- wordpress:/var/www/htmldb:
image: mysql:5.7restart: alwaysenvironment:
MYSQL_DATABASE: THIS_SHOULD_APPEARMYSQL_USER: THIS_SHOULD_APPEARMYSQL_PASSWORD: THIS_SHOULD_APPEARMYSQL_RANDOM_ROOT_PASSWORD: '1'volumes:
- db:/var/lib/mysqlvolumes:
wordpress:
db:
- Startup the docker-compose with
docker-compose up -d - Enter the wordpress container with
docker exec -it wordpress_container bash - Look inside the wp-config.php file:
cat wp-config.php
Expected Result
**/ ** MySQL settings - You can get this info from your web host ** ///** The name of the database for WordPress */define( 'DB_NAME', getenv_docker('WORDPRESS_DB_NAME', 'THIS_SHOULD_APPEAR') );
/** MySQL database username */define( 'DB_USER', getenv_docker('WORDPRESS_DB_USER', 'THIS_SHOULD_APPEAR') );
/** MySQL database password */define( 'DB_PASSWORD', getenv_docker('WORDPRESS_DB_PASSWORD', 'THIS_SHOULD_APPEAR') );
/** * Docker image fallback values above are sourced from the official WordPress installation wizard: * https://github.com/WordPress/WordPress/blob/f9cc35ebad82753e9c86de322ea5c76a9001c7e2/wp-admin/setup-config.php#L216-L230 * (However, using "example username" and "example password" in your database is strongly discouraged. Please use strong, random credentials!) *//** MySQL hostname */define( 'DB_HOST', getenv_docker('WORDPRESS_DB_HOST', 'THIS_SHOULD_APPEAR') );
/** Database charset to use in creating database tables. */define( 'DB_CHARSET', getenv_docker('WORDPRESS_DB_CHARSET', 'utf8') );
/** The database collate type. Don't change this if in doubt. */define( 'DB_COLLATE', getenv_docker('WORDPRESS_DB_COLLATE', '') );
**Actual Result
**/ ** MySQL settings - You can get this info from your web host ** ///** The name of the database for WordPress */define( 'DB_NAME', getenv_docker('WORDPRESS_DB_NAME', 'wordpress') );
/** MySQL database username */define( 'DB_USER', getenv_docker('WORDPRESS_DB_USER', 'example username') );
/** MySQL database password */define( 'DB_PASSWORD', getenv_docker('WORDPRESS_DB_PASSWORD', 'example password') );
/** * Docker image fallback values above are sourced from the official WordPress installation wizard: * https://github.com/WordPress/WordPress/blob/f9cc35ebad82753e9c86de322ea5c76a9001c7e2/wp-admin/setup-config.php#L216-L230 * (However, using "example username" and "example password" in your database is strongly discouraged. Please use strong, random credentials!) *//** MySQL hostname */define( 'DB_HOST', getenv_docker('WORDPRESS_DB_HOST', 'mysql') );
/** Database charset to use in creating database tables. */define( 'DB_CHARSET', getenv_docker('WORDPRESS_DB_CHARSET', 'utf8') );
/** The database collate type. Don't change this if in doubt. */define( 'DB_COLLATE', getenv_docker('WORDPRESS_DB_COLLATE', '') );
**
Hello, while testing with the new
latestWordPress (5.8) I noticed the environment variables not being parsed correctly resulting in aError establishing a database connectionerror.Steps to Reproduce
wordpress:latestimagedocker-compose.ymlfile based on the official documentationdocker-compose up -ddocker exec -it wordpress_container bashcat wp-config.phpExpected Result
Actual Result