Gitlab Docker Update

路线

升级前明确升级路线
参考

备份

利用 gitlab-backup 命令进行备份

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

复制备份至宿主机

1
2
cd ~/gitlab/backups
docker cp <container name>:/var/opt/gitlab/backups/xxx_gitlab_backup.tar .

升级

停止现有容器

1
docker stop <container name>

删除现有容器

1
docker rm <container name>

拉取新的容器镜像

1
docker pull gitlab/gitlab-ce:13.12.15-ce.0

启动新的容器

1
docker-compose -f gitlab.yml up -d

docker-compose 配置如下

1
2
3
4
5
6
7
8
9
10
11
12
13
14
web:
image: 'gitlab/gitlab-ce:13.12.15-ce.0'
restart: always
hostname: 'git.xxx.com'
environment:
GITLAB_OMNIBUS_CONFIG: |
gitlab_rails['gitlab_shell_ssh_port'] = 2224
ports:
- '8081:80'
- '2224:22'
volumes:
- '/opt/gitlab/config:/etc/gitlab'
- '/opt/gitlab/logs:/var/log/gitlab'
- '/opt/gitlab/data:/var/opt/gitlab'