General Guides

Search Knowledge Base by Keyword

Install Docker and WordPress On Ubuntu

You are here:

What is Docker? Docker is a containerization platform that performs operating system level virtualization, which lets you run lightweight containers in isolation. The following document will take you through the steps to install Docker and run a WordPress & MySQL container.


Installing Docker

Step 1:  Install docker from from the official repository.




Step 2:  Use the command below check to verify the version.




Step 3:  Now install Docker Machine by grabbing from it’s github repo and making it executable, running the following commands








Step 4:  Install Docker Compose, same as earlier and making sure it’s executable running the following commands








Step 5:  Let’s check the versions of docker-compose and docker-machine.








Launching WordPress & MySQL Containers

To run WordPress, you will need to run two separate containers. Besides WordPress container you must also install the database container.


Step 1:  Start by pulling the docker image.




Step 2:  Launch MySQL by running the following command:



The command we just ran launches the MySQL in the background; we are calling the container mysql by using (–namewordpress). The following two environment variables (using -e) to set the MySQL root password to wordpress (-e MYSQL_ ROOT_PASSWORD=wordpress) and created a database called wordpress (-e MYSQL_ DATABASE=wordpress).

For the sake of security it is highly recommended to use a more complex password during your own setup.


Once you’ve launched the MySQL container, you should have received a container ID.


Step 3:  Verify the container is running as expected by using the following command:




Supplemental step: to check the status of your mysql container run the following command.




Step 4:  Now we install the WordPress container image.




Step 5:  Launch the WordPress container




Step 6:  Verify the wordpress container is running as expected by using the following command:




Step 7:  If you notice that it isn’t on your can start the wordpress container by issuing the following command.




Related Articles