This post will show you how to install WordPress using Docker. We will also link our WordPress container to the MySQL container that we created in the previous post. This will give us the capabilities to scale each group of containers separately. Meaning we can scale the database, as well as the WordPress front end separately giving us much more flexibility.
In order to follow along in this post please review my post showing how to install MySQL using Docker
Install WordPress using Docker
First things first, lets login as root to save us from having to type sudo.
Once that is out of the way, we are going to download the WordPress image
docker pull wordpress:latest
This next step is very simple, but can require a little bit of research if you want to get very customized.
docker run --name test-wordpress --link test-mysql:mysql -p 80:80 -d wordpress
The –name option is going to name our container. The –link option is going to tell this container to link with the container we created previously. The -p option is going to map the internal port with the external port (-p host port:container port). So in my case, I used 80:80 to tell it that I want to map my host port 80 to the internal container port 80.
The options for this particular image can be located here
If you haven’t previously installed MySQL, I recommend using the Tutum Image