Problems I had upgrading containers with docker-compose

This blog is running in the official ghost:alpine container. In a previous post I described the docker-compose.yml file that I used to bring up the application. It's all running on a Digital Ocean Ubuntu 16.04 VM. So far, so good.

If a container version is upgraded on the repo, I hypothesized that merely running docker-compose restart would pull the most recent release. And indeed that is the case. Except that the database migration that was included in the recent Ghost upgrade didn't work, and consequently, the service never came up. So just running docker-compose restart did not do everything, although it did get almost completely through the upgrade.

Next I tried just running docker-compose up and the upgrade choked at the same place as the previous attempt. I did start panicking a little at that point, as my website was still not showing up. For reasons I do not completely understand, doing docker-compose down then bringing it back up fixed the migration. Probably because I was getting this specific error: Docker-compose down/up removes the old running stuff and builds everything back up from scratch, so maybe the instruction to upgrade ghost-cli came after the instruction to install ghost itself. And they do talk about the CLI upgrade here:

It's interesting how you learn about these issues after the damage is done. Bigger question: how to avoid them in the first place? Is it simply doing a dry-run in a dev environment, then working out the "bugs" before launching?

The blog admin section in Ghost is no longer asking me to upgrade it, so everything is current. And I am going to move on to other things.

unsplash-logoVadim Sherbakov