Based on two blog posts (part 1, part 2) describing how to use Docker for WordPress plugin, theme and MultiSite development.
Install Docker and Docker Compose, then:
git clone https://github.com/gravityrail/wordpress-docker-compose-example.git
cd wordpress-docker-compose-example
docker-compose up
You'll see a bunch of output from the running processes - nginx, php-fpm and mysql.
On OS X, open a new Terminal window and enter:
open "http://$(boot2docker ip):8080"
If everything worked correctly, you should see the installer for your WordPress web site!
You should also see a src
directory within the git repo which contains the latest version of WordPress. You can edit this code, unzip plugins and themes and customize to your heart's content and all the changes will show up instantly when you reload the URL in your browser.
As an added bonus, which container adds the wp
command from the wp-cli project. This allows you to modify your WordPress site from the command line.
To run this from outside the container, you can use "docker-compose run" like this:
docker-compose run wordpress wp --allow-root plugin install hello-dolly
This is a bit verbose, so you may want to create this alias and save it in your ~/.profile
alias docker-wp='docker-compose run wordpress wp --allow-root'
Which turns the command above into:
docker-wp plugin install hello-dolly
Cool, right? Want to create a new plugin but tired of writing all that scaffolding? Now just run:
docker-wp scaffold plugin my_super_plugin --plugin_name="My Super Plugin"