Back up GitLab running in a Docker container


  • Tier: Free, Premium, Ultimate
  • Offering: GitLab 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.

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.

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 roll back a Docker instance.