Tuesday, July 29, 2025

Quick Wordpress testing using Docker on Linux

Recently I've been investigating how to migrate from Google Blogger to Wordpress. The best solution for me so far is by using Google's takeout to get a feed.atom file and use a python script to copy over posts, comments and images.

Along the way, I needed to run Wordpress and my normal approach to this was to install Ubuntu Linux and manually set up mysql, nginx, php, and wordpress. This gets tedious. I've played with docker in the past but was very pleased to find that there is an official wordpress compose.yaml and this makes it very quick to get up and running. (Ubuntu 24.04.2 LTS)

curl -fsSL https://get.docker.com -o get-docker.sh 

sudo sh get-docker.sh 

sudo usermod -aG docker $USER

# log out and back in then test

docker run hello-world

docker info

mkdir wp-docker

cd wp-docker

# save the compose.yaml file

# from https://hub.docker.com/_/wordpress

docker compose up

Then visit the machine's web port 8080 like http://latitude.local:8080/ 

The first time you get this:


The two docker containers, one for mysql, the other for the apache web server, already know how to talk to each other. After just a little config we have Wordpress:


The terminal that you did the 'docker compose up' in can be gracefully shut down with Control-C.

To wipe it all, so you can start fresh or get some space back:

docker compose down --volumes

Note that docker is extremely efficient and takes much fewer resources than running a full vitual machine.

macOS?

It's even easier and nicer on macOS. Install OrbStack which provides VMs and Docker and is free for personal use. I'm on Apple Silicon and it all "just works". The UI has a link to click to go to it in the browser.

Amazing.

No comments: