How to upgrade Ghost in docker containers 👻

How Ghost upgrade in docker container

How to upgrade Ghost in docker containers 👻
Photo by JESHOOTS.COM / Unsplash

I'm using Ghost as my blog website and today I faced a important question how to upgrade Ghost to latest version?

TL;DR

If you are running ghost with docker containers just upgrade to latest version by updating to latest ghost docker image. 🎉

First step

well the first step could be obvious but it is do a backup of your files, in my case I did a backup of my database MySql by running:

docker exec <DB_CONTAINER_ID> /usr/bin/mysqldump -u <DB_USER> --password=<DB_PASSWORD> --no-tablespaces <DB_NAME> > backup.sql

that creates a file called backup.sql with the backup.

I also did a backup of my config.production.json file from my ghost container.

Now Upgrade to latest Ghost version 🏎

when I was writing this post my current Docker image version of Ghost was 5.33.6 and the latest available was 5.79.4 as I was using docker-compose I just needed to change the version image in my docker-compose.yml file:

Before

version: '3.1'

services:

  ghost:
    image: ghost:5.33.6

After

version: '3.1'

services:

  ghost:
    image: ghost:5.79.4

After that I did a docker-compose down and docker-compose up -d to restart and download the newest docker image.

After that I was enjoying the latest Ghost version 😎