Docker, specifically Docker compose, has served me well in keeping a sane development environment for my WordPress projects. MAMP was too much of a black box, and having a local PHP and SQL for both MediaWiki and WordPress was going to be more maintenance than I would have time for. With compose I have little to no maintenance burden, and my system is squeaky clean.
The way this is setup is that both the services share a part of their file system with the host. The
mysql one shares all the database data, making it easier for me to move test data around different instances and configurations of WordPress that I might be running. And, to be able to work on plugins and themes the
wordpress service shares the
wp-content directory. This way, I can easily clone and work on anything directly on my local system.
With this, all I need to do now to setup a new WordPress install is — create a new directory, copy this YAML file into it, and run
docker-compose up. I change the
wordpress service’s port mapping when I need to run multiple instances at once. That’s it!