docker下gitlab备份还原
作者:互联网
1、创建备份命令
gitlab-rake gitlab:backup:create
2、还原命令
从指定时间戳的备份恢复(backups目录下有多个备份文件时)
gitlab-rake gitlab:backup:restore BACKUP=1500809139
从默认备份恢复(backups目录下只有一个备份文件时)
gitlab-rake gitlab:backup:restore
3、容器中脚本定时备份-backup.sh
#执行备份命令,先检查之前的备份是否存在
docker exec -it jq-gitlab /bin/bash -c 'if [ -f /var/opt/gitlab/backups/*.tar ];then rm -rf /var/opt/gitlab/backups/*.tar;fi && gitlab-rake gitlab:backup:create && exit'
# 将备份文件从容器中复制出来异地存储
docker cp jq-gitlab:/var/opt/gitlab/backups /var/opt/gitlab/
标签:opt,备份,gitlab,var,backups,backup,docker 来源: https://www.cnblogs.com/pgy674477230/p/15525178.html