我用的容器镜像是 twang2218/gitlab-ce-zh:latest 所以没有redis和postgresql
1,进入容器备份数据
gitlab-rake gitlab:backup:create /var/opt/gitlab/backups/
2, 给它弄走
mv 1553072122_2019_03_20_11.1.4_gitlab_backup.tar ../
3,去新建一个gitlab
docker run --name='gitlab_test' -d \
-e 'GITLAB_PORT=10081' \
-e 'GITLAB_SSH_PORT=10023' \
-e 'GITLAB_BACKUPS=weekly' \
-p 10023:22 -p 10081:80 \
--volume /mnt/gitlab/config:/etc/gitlab \
--volume /mnt/gitlab/logs:/var/log/gitlab \
--volume /mnt/gitlab/data:/var/opt/gitlab \
twang2218/gitlab-ce-zh:latest
4,进去 新容器 更改权限
chown git.git 1553072122_2019_03_20_11.1.4_gitlab_backup.tar
把包 扔回 backups里面
mv 1553072122_2019_03_20_11.1.4_gitlab_backup.tar ./backups/
5,关闭相关服务
[email protected]:/var/opt/gitlab# gitlab-ctl stop unicorn
ok: down: unicorn: 1s, normally up
[email protected]:/var/opt/gitlab# gitlab-ctl stop sidekiq
ok: down: sidekiq: 1s, normally up
6 开始恢复(这里不要写全名 他会自动拼接)
gitlab-rake gitlab:backup:restore BACKUP=1553072122_2019_03_20_11.1.4
噔噔
有问题再来问我吧 qq:48564021