How to migrate data from old docker gitlab container to new container

I have a very old docker gitlab that was running fine until i tried to upgrade and the rest is history. It never worked.

So now my plans are to setup a new container on a new server and then just copy over the git repo data from the old docker host to the new docker host running the new container

here are the volumes i exposed to the host for both the old and new containers

--volume /srv/gitlab/config:/etc/gitlab 
--volume /srv/gitlab/logs:/var/log/gitlab 
--volume /srv/gitlab/data:/var/opt/gitlab

what i have tried it check the gitlab data directories to see where the git repos are stored on the old docker host but i cant find anything as it shows empty

root@gitlab:~# ls -lha /srv/gitlab/data/git-data/repositories/
total 48K
drwxrws---  9 998  998 4.0K Aug  9  2021 .
drwx------  3 998 root 4.0K Jun  8  2016 ..
drwxrwx---  2 998  998  12K Oct 24  2020 devops
drwxr-sr-x  3 998  998 4.0K Aug  1  2021 +gitaly
-rw-------  1 998  998   64 Jun 18  2020 .gitaly-metadata
drwxr-s--- 91 998  998 4.0K Oct 24  2020 @hashed
drwxr-s---  3 998  998 4.0K Oct 25  2020 @snippets




root@gitlab:~# ls -lha /srv/gitlab/data/git-data/repositories/devops/
total 16K
drwxrwx--- 2 998 998  12K Oct 24  2020 .
drwxrws--- 9 998 998 4.0K Aug  9  2021 ..

so anyone know where the git repo data are stored on a docker host running gitlab?

Hi @gurumacanoob

your data will be in the @hashed directory.

Here is docs regarding storage types.

Yeah i find them in the @hashed directory now but back to my question

How do i migrate these data to new gitlab server???

I assume you use the same DB and everything else, you just need to mount the volumes like you did on the old container. Nothing special should be required.
But you need to follow the official upgrade paths, you cannot just run the latest version, that won’t work if you were on really old one.

No am not using the same database because i mentioned i have this running on docker on a different host and the new server is on another docker host elsewhere

I mentioned frustrations with upgrading, old server is on version 10.* and i have attempted upgrade and it is failing and not working

I want to talk about migrating data only as question states, if it is not possible then will like to know, if it is then that is what i want to do

appreciate the help

Here is the official documentation Migrate to a new server

gitlab will not even start on the old server because of hair pulling from upgrading. So at this point all am left is to just migrate the data over

how will i do backup if the gitlab container will not even start???

It might be easier just to get the broken upgraded gitlab running then copying stuff over. I suppose you could copy the repository data, that should be fine. But if your RDS is corrupt you need to create all the groups/repos manually and then copy the respective repo data into the directory for each new repo.

What is RDS? Again old gitlab was running in single container using the omnibus docker image. Last working version was version 10.*

I am fine manually copying files over but under the @hashed directory, the repo are named with hashed values and no way to know what repo is what

again i have spent months on trying to fix this upgrade and it did not work
so i am fine finding a way to copy over the data and be able to use it again

am sure if you look around you will many failed gitlab upgrades, there should be a way out for people that cant get to have upgrade working and here i am asking for help for that

well, best practice is to do a backup/snapshot before upgrade so if it goes wrong you can rollback to working version. I mean it’s not that hard nowdays with all the Public Cloud providers.

RDS = relational database like postresql or mysql

the hash is SHA256(project.id) as stated in the first docs I have linked. So you know how the hash is calculated and since you have not mentioned your database is completely broken I assume you are able to connect and do a select there are find IDs of each project.
I know that your GitLab won’t start, but that doesn’t mean you can’t disable all services and keep only postresql running. If you can’t do that run another postgres container and link the DB datafiles into it.
If you even can’t do that then you need to figure out manually which data belongs to which repository.
If I remember right, there was a file in each repo folder with some gitlab metadata.

here are errors when i tried to run the gitlab container with last running version

docker run --detach --hostname gitlab.abc.xyz --publish 443:443 --publish 80:80 --publish 22:22 --name gitlab --restart always --volume /srv/gitlab/config:/etc/gitlab --volume /srv/gitlab/logs:/var/log/gitlab --volume /srv/gitlab/data:/var/opt/gitlab gitlab/gitlab-ce:11.11.8-ce.0

so you saying i should take a dump of the database and import into the new database???
will that work, if newer versions have a different database schema???