We saw in a previous post how we can Docker stores the stateful/persistent data for containers in volumes. This makes migrating between Ghost instances very easy.

However when upgrading from 0.11 to 1.17 we can't just transfer volumes as the files are structured differently; instead we need to export the JSON backup through the GUI.

After procrastinating for ages, I finally have migrated this site to Ghost 1.x and so far have no regrets

Make a JSON backup of your blog

You can do this in the Labs section in Ghost Admin

Stop the old container

$ docker stop $old_container

Create a named volume

$ docker volume create $blogname

Create and start the new container

$ docker run --detach -v $blogname:/var/lib/ghost/content --name $blogname --publish --env url="$url" ghost:latest

Copy images and other static assets from old volume to new

old_vol=$(docker inspect $oldcontainer | grep Source | cut -d: -f2 | cut -d\" -f2)

$ cp -r $old_vol/images  $new_vol

Log into the new blog and import the JSON file