Upgrade Running Docker Ghost website

I’m currently running a ghost instance using docker using version 3.41.5 using a mysql database for a backend.

I would love to know if there is an upgrade guide for docker use case? I realize that there is a documentation for the bare metal install here but I couldn’t find any instructions if you’re using a docker instance?

I was going to go through the steps as best as I can figure out, but if the ghost community is maintaining a docker image, then we should also have some instructions on how to migrate from one version to the next.

My current thought is going inside the running 3.41.5 container, running ghost update, assuming everything goes fine, stopping the container, updating the version.

ie.

Step 0: take full database backup of database, backup content folder, and download entire site content via Admin interface.
docker exec -it <containerID> --rm /bin/bash
npm install -g ghost-cli@latest
ghost update
docker stop <containerID>
update docker compose to point to 4.0.1
docker-compose up -d 

Haven’t confirmed it, but it’d be great if there was a more official instructions on the process.

Since Ghost runs migrations as part of starting Ghost, you should, in theory, be able to just upgrade your image from 3.latest (be sure to be on the latest version of 3.x as per Ghost’s migration policy) to 4.x. The CLI hasn’t run migrations for Ghost for a while.

That being said, I personally don’t use Ghost with Docker so I can’t say if it worked or not from me.

It worked for me …

I have successfully upgraded ghost from 3.2.2 to 4.0.1

I am using docker with docker-compose

If you are using docker then you dont need ghost cli

you can upgrade using via command

docker-compose pull && docker-compose down && docker-compose up -d
1 Like

Simply using the new tag did not work for me in my docker setup. After using the new image, I encountered an exception, where the SQLite dependency could not be found. Probably, because the files for the 3.x version was not included in the docker image.

I instead opted to use the ghost:3 for the moment and upgrade using the ghost-cli npm package.

docker exec -it ghost-container-name
# >> Then in the attached container
npm i -g ghost-cli
su node
ghost update v3 # or whatever your current major version is
ghost update
exit

Then, back in your host machine, bump the tag to :4 und deploy the container as you normally would. As i used docker-compose it is as simple as docker-compose restart.