Update Ghost on Docker

Guideline for updating Ghost 5.x hosted as docker container

Update Ghost on Docker
Photo by CHUTTERSNAP / Unsplash

Applicable Ghost Version: 5.x

Backup Data

Content

cd /var/www/ghost/content

Compress content

contents zip -r content-files.zip images/ files/ media/

(Optional)Move the zip files from your server onto your local machine.

scp user@remote_IP:/var/www/ghost/content/content-files.zip ~/Desktop/content-files.zip

Built-in Export

In the ghost admin dashboard, find:
Settings => Labs => Export your content
A json file will be generated that can be imported back in a fresh Ghost installation if anything goes wrong.

(Optional)Database

MySQL

docker exec db_container_name mysqldump [--user yourusername] [--password=yourpassword] databasename > /desired/path/to/db.dump

Update Docker Container

Run the following steps one by one:

docker-compose down

docker-compose pull

docker-compose up -d

Update Failed

If there are issues after the update and a big gap between the existing and latest ghost versions, it is likely such a version jump is not supported properly.
Check all available versions. Minimising the version gap, and repeating the update step multiple times will likely resolve the issue.

Ghost runs the update migration process during the first fire-up of the program, thus the sequence of updates is significant.