Repositories lost after restart gitlab

(I use docker to deploy my gitlab) At first, I can’t push my code to gitlab, then I use gitlab-ctl status to check the gitlab status all module status is running. So I restart gitlab’s containter. Then I can’t visit my gitlab web pages! and I find my gitlab configs lost! but data files still exist (I mount the configuration files in my own path).In order to restore gitlab service,I copy the data files as backup at first, then I start a new gitlab container and copy the automatically generated configuration files to my own path and then restart my old gitlab container. I finally can visit gitlab web pages! but some repository lost!


How can I fix this ? I guess if this situation occurs because the configuration files is missing or my new configuration files is not correct(I didn‘t backup my gitlab configuration files)
I really wish you could help me :persevere:

I had this same problem! For me, the missing repos were caused by the volumes not being attached.

Are you able to share you docker commands or compose file that you are using to run the instance?

Here is docker commands

docker run -d  \
        -p 1443:443 -p 8001:80 -p 10022:22 \
        --name gitlab --restart always \
        -v /root/docker/gitlab/config:/etc/gitlab \
        -v /root/docker/gitlab/logs:/var/log/gitlab \
        -v /root/docker/gitlab/data:/var/opt/gitlab \
        gitlab/gitlab-ce:15.4.6-ce.0

By the way, I found I missed some project in gitlab-data path by useing hashed project id to find project in gitlab-data directory.

Can you do a docker ps -a and confirm that this container is running and is the only gitlab instance running?

Can you do a docker container inspect <container_name> | less and look for the volume information and confirm that it is what you expect it to be for that container?

Do you have a copy of your gitlab secrets file gitlab-secrets.json before you were having issues? If yes, are you able to compare the two and make sure they are the same and that your gitlab-secrets file was not over written. (you not being able to push earlier, makes me think that the encryption might changed)

Do NOT share the gitlab-secrets.json file here!

1 Like