Docker. It’s good. That’s all. Okay, fine, I’ll elaborate. Pull up a chair, it’s time to dive into the best solution for a home lab.
About a year ago I found myself in need of a better way to host this very website. AWS EC2 was fine, but was a pain to manage for how simple this is, so I moved to Lightsail. Lightsail was great… but the price kept creeping up. Self hosted was the way to go, but installing WordPress locally to test is a pain in the neck. I already have some shocking number of abandoned web servers on my machine, serving tests and static pages and other hobby projects. How do I avoid one more?
That’s where Docker comes in*. Why install anything on this machine when Docker will happily run almost anything I want in a container? New version? One click. Want another instance because the last one kind of melted down? One click. Try out a different platform? 5 minutes. Docker makes taste testing software fast, easy, and safe. What a deal!
So, how? First off, get Docker. In an elevated PowerShell console:
winget install --exact --id Docker.DockerDesktop --accept-source-agreements --accept-package-agreements
Yes, that’s package management on Windows. Living in the gosh darn future. Then grab a WP image:
docker pull wordpress:latest
Run it via ‘docker up’ or… fine, you can use Docker Desktop. It’s quite good. In the ‘Images’ tab find your shiny new WP image and press the little play button. That’s it. That’s the whole thing. You have the WordPress ‘Hello World’ running locally. Hit stop, it stops. Delete the container, that instance is gone and you can start another one, or 10, or 100… maybe not 100. Try themes side by side, install all the plugins, break everything then unbreak it, then export the container and run it anywhere. No more, “It works on my machine” or, “You can’t install that, it’ll conflict with [thing]!” I build containers on this machine and fire them over to my home theater PC. No more WP Multi, no more paying for test sites, and no more destroying your machine’s ability to run common packages because some detritus somewhere is crashing everything. This is the dream that the cloud promised, but the cloud is just a cute whale in the notifications bar.
* The astute observer might notice that this site is not, in fact, running in a container. It’s on Bluehost (they’re fine), but I do have WP running locally with a draft of this site, along with Jellyfin for home theater media management, network monitoring, two Python dev environments, and various other bits and bobs. Getting this container running on AWS is on my todo list but you know how it is…