How to export gitlab backup in Gitlab Docker container
GitLab provides an integrated feature to export a TAR file containing all data from the current GitLab instance.
How to make a GitLab backup?
In order to run this for a GitLab instance running on docker-compose use
gitlab_backup_docker_compose.sh
docker-compose exec gitlab gitlab-backup create STRATEGY=copywhere gitlab is the container running the gitlab image, e.g. gitlab/gitlab-ce:latest.
In case you are running a docker-based setup without docker-compose, run
gitlab_backup_docker.sh
docker exec my-gitlab-container gitlab-backup create STRATEGY=copywhere my-gitlab-container is the ID or name of the container
Where to find the backups?
By default, gitlab stores the backups in /var/opt/gitlab/backups. In case you need to change this, look for the following line in /etc/gitlab/gitlab.rb:
gitlab.rb
gitlab_rails['backup_path'] = "/var/opt/gitlab/backups"In my docker-compose configuration, I map out the entire /var/opt/gitlab directory:
docker_compose_volumes.yml
volumes:
- './data:/var/opt/gitlab'hence I can find the backups in ./data/backups:
list_gitlab_backups.sh
$ ls data/backups/
1607642274_2020_12_10_13.6.3_gitlab_backup.tarCheck out similar posts by category:
Docker
If this post helped you, please consider buying me a coffee or donating via PayPal to support research & publishing of new posts on TechOverflow