Move Gitea to a new Docker Host


I have been running Docker Gitea (with Docker postgres:9.6) on a CentOS 7 without any problems so far. I created a new “Docker Host” that is based on CentOS 8 now and I want to “move” my containers from old docker host to the new one.

Now regarding Gitea, I am trying to “move the settings/repositories/…” it to the new docker host, too. I read this thread:

and found also this:

My Gitea Backup & Restore Scripts · GitHub (which assumes mysql as DB for Gitea)

Anyhow, I am not sure, which steps I should follow…

Any help would be appreciated :slight_smile:

First af all, you know that CentOS 8 will stop receiving updates by the end of the year? You can migrate to Rocky Linux or Alma Linux, which are exactly the samw distro as CentOS 8, but will be supported until RHEL 8 end-of-life.

Regarding the data migration, you can just copy the data that is stored as mounts on your old host to the new one and point Docker on the new host to mount them.

Stop the containers first. Say your gitea-container on the old host is launched with -v /home/user/data:/data, you can tar the stored folder (tar -czvf gitea-data.tar.gz /home/user/data), copy the tar.gz to the new host, unpack it, (cd /; tar -xzvf /path/to/gitea-data.tar.gz). Note changind directory to /, the tar package will contain the full path and create a matching directory structure. Do the same for the Postgres container’s data. You’ll need to create/unpack the tar packages as root, it’s the simplest way to preserve file permissions.

You can use any method you want to move the data mounts over, this is just an example to preserve the file permissions.

Then you’ll need to use the same commands you used on the old host to make the containers on the new host. Don’t use latest, use the same versions that were running on the old host, e.g. postgres:9.6 and gitea:15.2.

If you’re using docker-compose, you can use the same docker-compose file on both hosts, as long as the data is stored in the same directories on both hosts.

Docker’s idea is to make everything portable, when you launch a certain version of a container, everything inside the container is exactly the same regardless of the host OS.

Thanks for the tips! I have tried already to tar the contents of the volumes and move them that way to the new volumes, but it didn’t help. I was getting the error “Received signal 15; terminating.”. I searched these kind of errors in Github/gitea and it seemed to be related to DB. I used also exact the same docker images with the same digest… Anyway, I gave it up :slight_smile: I cloned the repositories to a temp host with the --mirror option and pushed them to the new docker host also with the mirror option. The commits were maintained this way. I am not that big expert with git, but this worked for me.

And thanks for the info about the CentOS 8. I missed it somehow…