Migrate Dockerized Gitlab

One of the great things about docker and volumes is the theory that I should be able to easily re-deploy on another docker host without issue. Unfortunately this does not appear to be the case with Gitlab.

I used this tutorial for setting up gitlab on the original Amazon linux instance, and the new Ubuntu instance that will replace it. I made sure to update the Gitlab images on both, so they should both be running the same version of Gitlab.

I then tried gracefully stopping the gitlab container on the amazon linux instance before compressing the volume using tar.gz and transferring it to the other server before extracting and re-deploying. When that didn’t work, I tried using rsync and being sure to keep the same permissions. That didn’t work either. The container would keep restarting itself and the logs showed the following error:

Error executing action run on resource 'execute[/opt/gitlab/embedded/service/gitlab-shell/bin/gitlab-keys check-permissions]

Eventually, I cloned the volume of the Amazon Linux instance and mounted the clone on the Ubuntu instance. I then ran this command to give me access:

find . -type d -exec chmod 755 {} \;

Before then being able to re-deploy the container. Initially I had thought this was successful, but it appears to not have been and I have a fresh gitlab setup.


What is the proper/ideal way to move the docker volume from one host to another in order to migrate gitlab?

@programster, Interesting discussion here on the proper backup and restore process with GitLab on docker:


I just finished a migration and all went well.
While testing migration, the only problem I found was when the file permission were incorrect due to using different users in the 2 systems.
Thing to note was I have external postgresql and redis docker images. I just setup gitlab docker images and copied the directories under the volume.

@hozawa that’s interesting. When you migrated did you migrate between two of the same distros or different ones? I wonder if my problem is down to the fact that I am migrating between Amazon Linux and Ubuntu which are quite different, or if I am having problems because I am not using external postgresql and redis docker images.

I’ll try again later with the useful info @jamesmundia linked.