So I forgot to update the blog since version 2.3x.x - This means had to upgrade ghost to the latest version of 2.38.3 before leap frogging to version 4.x. according to upgrade guide from ghost blog official site
List docker containers to get an idea of the environment
sudo docker ps
List docker images to check which version of ghost we have running
sudo docker images
Download ghost version 2.38.2
sudo docker pull ghost:2.38.2-alpine
Remove the old docker container
sudo docker rm -f <container ID of old ghost blog>
Remove the old docker image
sudo docker rmi <image ID>
Restart docker container with the newer ghost blog version
sudo docker run --restart=always -d -e 'ROOT_URL=https://<blog URL>' -e 'VIRTUAL_HOST=<blog URL>' -e 'NODE_ENV=production' -e 'url=https://<blog URL>' --expose 2368 -v /home/Blog:/var/lib/ghost/content:rw ghost:2.38.2-alpine
Check if the container restarted with the correct image
sudo docker ps
If you want to track the restart process by viewing logs, use the command
sudo docker logs -f <container ID>
After the ghost blog comes back online successfully, we can move on to download the desired ghost version 4.9.4
sudo docker pull ghost:4.9.4-alpine
After the download is complete, list the current running docker containers
sudo docker ps -a
Remove the old container running the older version of ghost using this command.
sudo docker rm -f <container ID of old ghost blog>
The command below will force docker to spin up a new container which will use the latest version of ghost.
sudo docker run --restart=always -d -e 'ROOT_URL=https://<blog URL>' -e 'VIRTUAL_HOST=<blog URL>' -e 'NODE_ENV=production' -e 'url=https://<blog URL>' --expose 2368 -v /home/Blog:/var/lib/ghost/content:rw ghost:4.9.4-alpine
Run the command below one more time to confirm that the ghost blog is online and running the correct version
sudo docker ps -a