Installing WordPress on Docker

Over the last couple of weeks, I’ve noticed a few issues crop up on the WordPress sites that I manage both for myself and for friends and family. It was the type of issue that if something went wrong on one site, and because I ran them all from a single WordPress Multisite instance, it would break the others and I’d have to restart the cloud-hosted machine each time to try and figure out what was wrong.

After three days of this, I got to the point of just backing up all of the content, setting up a new Docker host and launching individual Apache instances for each site. It turns out this was easier said than done.

I started off by backing up each site with the Prime Mover plugin. I chose this one as not only does it have the ability to backup a multisite install and doesn’t rely on cloud services with limited storage, but that also has the ability to separate each multisite site out into its own backup.

Once that was done for each of the sites the real work began, creating a web server for each website. My original plan was a WordPress docker container and database for each site. Though the initial install went well the issue arose when I tried to restore the sites from their backups. Turns out the prime mover plug-in needs some PHP mods that aren’t included in the standard WordPress image. Try as I might I couldn’t get the required mod to install.

So I launched an Ubuntu image, found a list of every mod needed or suggested for both WordPress and the Prime Mover plug-in and tried again.

The restore worked! Amazing I thought nope it turns out that when I try to write a post about everything that’s happened, the draft won’t save due to the WordPress API not working.

After what felt like an eternity searching for answers it turns out I’d not included a tag in the so-confit file to tell I run SSL, I’d not enabled the mod rewrite module for Apache or enabled the rewrite function in the apache2.conf file either.

After fixing all of that everything now seems to be working as it should. A fair bit of copying and pasting later and I have all of the site running on their own docket container and Cloudflare tunnels managing actually getting everything from the server and onto the web.

I know this is not a very exciting blog post this week but I wanted to share how I finally got everything running correctly in the docker Ubuntu container, and it also makes sure I have this list backed up somewhere too. I’ve listed the commands I used below I hope it helps someone.

Similar Posts

Leave a Reply

Your email address will not be published. Required fields are marked *