How to Use the Official Docker WordPress Image

Originally published at:

In our previous articles in this series, we covered what Docker is, and then how to manually build Docker containers for WordPress.

In this article I’ll show you how to set up Docker in a much easier way. Docker has an official image for WordPress that makes it easier to get started. We’ll also check out Docker Compose for a Heroku-like configuration. After all, building and managing containers manually can take a lot of work.

The Official WordPress Docker Image

Before we get started, make sure you create a new folder and navigate inside that folder.

In my previous article we built a MySQL container. The official WordPress image (by the Docker team) requires you to have a running MySQL container.

Continue reading this article on SitePoint

If you are on OSX running through boot2docker you need to add port forwarding -p 80:80 I am not sure if it matters where:
$ docker run -e WORDPRESS_DB_PASSWORD=password -d -p 80:80 --name wordpress --link wordpress-db:mysql wordpress

Then you need to let VirtualBox know:
$ VBoxManage modifyvm "boot2docker-vm" --natpf1 "guestnginx,tcp,,80,,80"

$ boot2docker ip gives you the address of your machine for me I goto in my browser.

I got stuck on this for quite awhile. The section “Use the host-only interface (preferred)” at vbox-portforward by jonseymour cleared it up for me.

Thanks for this very clear & detailed tutorial.

Did you also get the following error after running docker-compose up?

web_1 | Complete! WordPress has been successfully copied to /var/www/html
mysql_1 | 2015-07-31T07:35:10.646809Z 2 [Warning] IP address ‘’ could not be resolved: Name or service not known

thank you Aleksander,
i started by following the official quickstart guide for wordpress/docker-composer but was confronted by the inability to add plugins/themes. and no clear explanation as to why. your series of guide cleared (and clarified) this hurdle.

now, i have a problem with using the wp import tool. my import XML is 2.5MB and so i hit the default PHP 2mb limit. i attached to the wordpress container

sudo docker exec -i -t da71a1506882 bash

but i can’t find the php.ini file i need change.


# locate php.ini

[SOLVED] in this git issue . yes!! that did the trick

This topic was automatically closed 91 days after the last reply. New replies are no longer allowed.