Please check gitlab-tutorial

Skip to content

Back up GitLab running in a Docker container

DETAILS: Tier: Free, Premium, Ultimate Offering: Self-managed

You can create a GitLab backup with:

docker exec -t <container name> gitlab-backup create

For more information, see Back up and restore GitLab.

NOTE: If your GitLab configuration is provided entirely using the GITLAB_OMNIBUS_CONFIG environment variable (by using the "Pre-configure Docker Container" steps), the configuration settings are not stored in the gitlab.rb file so you do not need to back up the gitlab.rb file.

WARNING: To avoid complicated steps when recovering GitLab from a backup, you should also follow the instructions in Backing up the GitLab secrets file. The secrets file is stored either in the /etc/gitlab/gitlab-secrets.json file inside the container or in the $GITLAB_HOME/config/gitlab-secrets.json file on the container host.

Create a database backup

Before you upgrade GitLab, create a database-only backup. If you encounter issues during the GitLab upgrade, you can restore the database backup to roll back the upgrade. To create a database backup, run this command:

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.

For more information on using the backup to roll back an upgrade, see Downgrade GitLab.