#以下操作需要进入容器内部
docker exec -it gitlab /bin/bash
1).创建备份文件
gitlab-rake gitlab:backup:create
使用以上命令会在/var/opt/gitlab/backups目录下创建一个名称类似为1547087542_2019_01_10_11.0.3_gitlab_backup.tar的压缩包, 这个压缩包就是Gitlab整个的完整部分, 其中开头的1547087542_2019_01_10_11.0.3是备份创建的日期
docker run --detach \ -p 1443:443 -p 10081:80 -p 10080:22 \ --name gitlab \ --restart always \ --volume /mnt/data/gitlab/config:/etc/gitlab \ --volume /mnt/data/gitlab/logs:/var/log/gitlab \ --volume /mnt/data/gitlab/data:/var/opt/gitlab \ gitlab/gitlab-ce
docker cp 1623317312_2021_06_10_12.1.0_gitlab_backup.tar gitlab:/var/opt/gitlab/backups/
#恢复 --恢复将删除gitlab 原有数据。
gitlab-ctl stop unicorn
gitlab-ctl stop sidekiq
gitlab-rake gitlab:backup:restore BACKUP=1547087542_2019_01_10_11.0.3
gitlab-ctl start