首先进入Gitlab
所在Docker
容器
docker exec -it <gitlab-container-name> /bin/bash
执行:
gitlab-backup create
然后退出容器、拷贝
docker cp <gitlab-container-name>:/var/opt/gitlab/backups /path/to/host/machine
还原的命令也很简单:
先停止
gitlab-ctl stop unicorn gitlab-ctl stop sidekiq
再还原
gitlab-backup restore BACKUP=timestamp_of_backup
例如
gitlab-backup restore BACKUP=1549251062_2019_02_04_11.8.1
然后重启即可
gitlab-ctl reconfigure gitlab-ctl restart