根据镜像名称进入容器
[root@shared-server backup ]# pwd
/mnt/download/tidb-tools/bin/backup
[root@shared-server backup ]#
[root@shared-server backup]# docker exec -it gitlab-zh bash
root@git:/#
# 开始备份
root@git:/# gitlab-rake gitlab:backup:create
Dumping database ...
...... # 省略
[DISABLED]
Creating backup archive: 1569026783_2019_09_21_10.7.5_gitlab_backup.tar ... done
Uploading backup archive to remote storage  ... skipped
Deleting tmp directories ... done
...... # 省略
Deleting old backups ... skipping
root@git:/#
root@git:/#
root@git:/#
# 查找备份文件
root@git:/# find / -name 1569026783_2019_09_21_10.7.5_gitlab_backup.tar
/var/opt/gitlab/backups/1569026783_2019_09_21_10.7.5_gitlab_backup.tar
root@git:/#
root@git:/#
将备份文件从容器中取出
[root@shared-server backup ]# docker cp gitlab-zh:/var/opt/gitlab/backups/1569026783_2019_09_21_10.7.5_gitlab_backup.tar .
[root@shared-server backup ]# ll
total 296M
-rw------- 1 root root 295M Sep 21 08:46 1569026783_2019_09_21_10.7.5_gitlab_backup.tar
[root@shared-server backup ]#

发表评论