Upgrade
DETAILS: Tier: Free, Premium, Ultimate Offering: Self-managed
In most cases, upgrading GitLab is as easy as downloading the newest Docker image tag.
Upgrade GitLab using Docker Engine
To upgrade GitLab that was installed using Docker Engine:
-
Take a backup. As a minimum, back up the database and the GitLab secrets file.
-
Stop the running container:
sudo docker stop gitlab
-
Remove the existing container:
sudo docker rm gitlab
-
Pull the new image:
sudo docker pull gitlab/gitlab-ee:<version>-ee.0
-
Ensure that the
GITLAB_HOME
environment variable is defined:echo $GITLAB_HOME
-
Create the container once again with the previously specified options:
sudo docker run --detach \ --hostname gitlab.example.com \ --publish 443:443 --publish 80:80 --publish 22:22 \ --name gitlab \ --restart always \ --volume $GITLAB_HOME/config:/etc/gitlab \ --volume $GITLAB_HOME/logs:/var/log/gitlab \ --volume $GITLAB_HOME/data:/var/opt/gitlab \ --shm-size 256m \ gitlab/gitlab-ee:<version>-ee.0
On the first run, GitLab will reconfigure and upgrade itself.
Refer to the GitLab Upgrade recommendations when upgrading between versions.
Upgrade GitLab using Docker compose
To upgrade GitLab that was installed using Docker Compose:
-
Take a backup. As a minimum, back up the database and the GitLab secrets file.
-
Edit
docker-compose.yml
and change the version to pull. -
Download the newest release and upgrade your GitLab instance:
docker compose pull docker compose up -d
Convert Community Edition to Enterprise Edition
You can convert an existing Docker-based GitLab Community Edition (CE) container to a GitLab Enterprise Edition (EE) container using the same approach as upgrading the version.
We recommend you convert from the same version of CE to EE (for example, CE 14.1 to EE 14.1). This is not explicitly necessary, and any standard upgrade (for example, CE 14.0 to EE 14.1) should work. The following steps assume that you are upgrading the same version.
-
Take a backup. As a minimum, back up the database and the GitLab secrets file.
-
Stop the current CE container, and remove or rename it.
-
To create a new container with GitLab EE, replace
ce
withee
in yourdocker run
command ordocker-compose.yml
file. However, reuse the CE container name, port and file mappings, and version.
Downgrade GitLab
WARNING: You must at least have a database backup created under the exact same version and edition you are downgrading to. Restoring the backup is required to revert the schema changes (migrations) made as part of the upgrade. The restore overwrites all newer GitLab database content with the older state. We can therefore only recommend a downgrade, if for example post-upgrade tests reveal problems that can not be resolved quickly.
To downgrade GitLab shortly after an upgrade:
-
Follow the upgrade procedure, by specifying an earlier version than you have installed.
-
Restore the database backup you made before the upgrade.
-
Follow the restore steps for Docker images, including
stopping Puma and Sidekiq. Only the database must be restored, so add
SKIP=artifacts,repositories,registry,uploads,builds,pages,lfs,packages,terraform_state
to thegitlab-backup restore
command line arguments.
-
Follow the restore steps for Docker images, including
stopping Puma and Sidekiq. Only the database must be restored, so add