I needed a WordPress development environment to research forum plug-ins. My WordPress instance is AWS so I decided to look into containers instead of running up a virtual machine as I have in the past for this type of task.
My WordPress instance is Linux and for many of the projects I get involved with these days involve Linux. I have typically used Windows workstations though I spent a couple of years using OSx for my desktop when I was working on iOS applications.
I understand the differences in the OSs and strive to keep my approach as OS independent as possible. In this case some of the commands in my Wiki are host specific and I only have only detailed the Windows script but for the most part I used the docker containers to accomplish the tasks so the host system wouldn’t matter.
Windows Subsystem for Linux
One of the issues I’ve always had with Windows is maintaining a compatible environment with Linux based tools. I am thrilled to see the introduction of Windows Subsystem for Linux. It isn’t perfect but for many tasks it fits the bill. Unfortunately I was looking for an environment that was isolated and this did not appear to be it.
Docker vs Virtual Machines
Docker has been on my mind for a couple of years but I hadn’t taken the time to look into it. My initial search on “Docker WordPress” looked very promising. Docker is like a package manger in that you compose a docker-compose.yml configuration file that defines the components you would like to put together.
I created shared directories and Docker containers that redirected and exposed ports. From there I extended the steps to include a backup, change-domain, and restore. Now I can pull my site (or any site) into a a docker environment on the local with very little effort.
Docker, and docker-compose provided exactly what I was looking for and then some. I’ve put together a Wiki with details on how to setup a development WordPress environment quickly.
To clone an existing site I’ve included steps for backup/restore and changing the domain name. The steps outlined are supported with Windows screen shots but for most commands the containers are used. There are a few changes that will have to be made if you are using a non-windows host related to drive letters.