Back up GitLab running in a Docker container
Tier: Free, Premium, Ultimate
Offering: Self-managed
You can create a GitLab backup with:
docker exec -t <container name> gitlab-backup create
Read more on how to back up and restore GitLab.
If configuration is provided entirely via the
GITLAB_OMNIBUS_CONFIG
environment variable
(per the “Pre-configure Docker Container” steps),
meaning no configuration is set directly in the gitlab.rb
file, then there is no need
to back up the gitlab.rb
file.
Backing up the GitLab secrets file is required
to avoid complicated steps when recovering
GitLab from backup. The secrets file is stored at
/etc/gitlab/gitlab-secrets.json
inside the container, or
$GITLAB_HOME/config/gitlab-secrets.json
on the container host.Create a database backup
A database backup is required to roll back a GitLab upgrade if you encounter issues.
docker exec -t <container name> gitlab-backup create SKIP=artifacts,repositories,registry,uploads,builds,pages,lfs,packages,terraform_state
The backup is written to /var/opt/gitlab/backups
which should be on a
volume mounted by Docker.