This is my docker-compose.yml
version: \'2\'
services:
wordpress:
image: wordpress
ports:
- \"8080:80\"
environment:
WORDPRESS_DB_P
Solution:
Remember to link the mysql container to the wordpress container:
links:
- db:mysql
Like this:
version: '2'
services:
wordpress:
image: wordpress
ports:
- "8080:80"
links:
- db:mysql
environment:
WORDPRESS_DB_PASSWORD: example
db:
image: mysql:5.7
environment:
MYSQL_ROOT_PASSWORD: example
This important detail is not mentioned on the WordPress image official Dockerhub page