1 min read

Ghost Blog Docker Installation and Migration

Related: Ghost Blog

Docker Installation


Here is a guide from the guy:

I've just completed two docker based ghost upgrades and it was flawless. I thought I'd note down my approach for anyone who might find it useful, I'm not sure how useful it'll be for the future documentation proposed but maybe it'll help a little.

I'm using docker-compose for them both so here's the steps I went through.

  1. Take a backup of the site in question first. For me it was enough to just get a json export dump which I've happily restored from in the past.
  2. Update the MySQL container to mysql:8.0.29, if you're using a different flavour YMMV. I did a full restart using docker-compose down && docker-compose up -d && docker-compose logs -f to allow the DB to come up from 5.x to 8 and then did a quick test that everything was still ok.
  3. Update to the top version of the major I was on. For me this was a case of going from 4.44-alpine to 4.48-alpine. Same deal command as above to do a full restart and another quick manual test.
  4. Update to ghost:5.0.2-alpine, another full restart using the docker-compose command above followed by another manual test.

This process worked for me with the various container versions above for two seperate sites on a dedicated Ubuntu 21.10 (GNU/Linux 5.13.0-41-generic x86_64) machine.

Final docker-compose file for both sites is:

version: '3.7'


    image: ghost:5.0.2-alpine
    restart: always
      - db
      - ""
      - ./content:/var/lib/ghost/content
      - ./config.json:/var/lib/ghost/config.production.json
      - ./db.env

    image: mysql:8.0.29
    restart: always
      - ./data:/var/lib/mysql
      - ./db.env

Ports and volumes might need a different config.

Useful Snippets


Upgrading to Ghost 5 and MySQL 8 with Docker-Compose