Run WordPress and MySQL On Docker Linux Host

This blog post will show you how to run WordPress and MySQL On a Docker Linux Host

Run WordPress and MySQL On Docker Linux Host

This deployment will use Docker Compose, which will deploy the following:

  • a WordPress container running the latest WordPress build
  • a MySQL container running MySQL 5.7b server
  • All the data that the containers are using is stored on volumes.
  • After deployment, WordPress will be available on port 80; however, you can change the file under ports.

Below, is the YML file that contains all the configuration.

You can change the values, but make sure the DB name-value matches in the DB and WordPress service.

I saved the file as docker-compose.yml inside a directory called wp01, but you can name the directory any name you like.

To deploy the solution, I will run the following command from the directory the file is located in.

After I finished the deployment, I will access WordPress using my server IP address and the port I used.


Below you can see the configuration wizard.

After I finished with the configuration I logged in and updated the default post by adding a photo to it.

If you run the command below, you will see that Docker composes created two volumes.

The first volume (wp01_db_data) is for the MySQL server.

The second volume (wp01_wp_data) is for all WordPress images, etc.

Check Status

To check the deployment status, I will use the command below.


I will run the command below to delete containers and leave the volumes attached.

If you keep the volumes and deploy again, the configuration will stay the same, and nothing will be lost.

To delete the containers and volumes, I will run the command below.

1 thought on “Run WordPress and MySQL On Docker Linux Host”

  1. hi, i’m using fedora 32 with podman, i have this error:
    Traceback (most recent call last):
    File “/usr/local/bin/podman-compose”, line 8, in
    File “/usr/local/lib/python3.8/site-packages/”, line 1093, in main
    File “/usr/local/lib/python3.8/site-packages/”, line 611, in run
    File “/usr/local/lib/python3.8/site-packages/”, line 666, in _parse_compose_file
    TypeError: ‘str’ object does not support item assignment

    ¿can you help me? thanks a lot

Comments are closed.