Difficulty: Beginner
Estimated Time: 10 minutes

In this scenario you will try to dockerize WordPress using Docker-Compose.

You now know how to simply dockerize WordPress.

04. Docker-Compose - WordPress

Step 1 of 5

Step 1 - Create simple WordPress stack

Create a simple WordPress stack using wordpress and mysql:5.7 images.

To configure DB credentials, use MYSQL_DATABASE, MYSQL_USER and MYSQL_PASSWORD variables on MySQL container. To set these credentials on WP container, use WORDPRESS_DB_HOST, WORDPRESS_DB_NAME,WORDPRESS_DB_USER and WORDPRESS_DB_PASSWORD variables.

Remember to:

  • Expose WordPress on 8080 port
  • Set proper DB credentials in both containers
  • Set MYSQL_ROOT_PASSWORD variable for MySQL to start
  • Mount /var/lib/mysql directory somewhere not to lose the data

Check documentation if you need any help.

When ready, run docker-compose up to setup your environment.


You can use docker-compose logs to view services logs.