docker 部署的gitlab备份与恢复

Posted

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了docker 部署的gitlab备份与恢复相关的知识,希望对你有一定的参考价值。

  • gitlab的docker-compose文件
    
    version: ‘3.5‘

services:
gitlab:
image: gitlab/gitlab-ce:11.7.5-ce.0

restart: always

hostname: gitlab
container_name: gitlab
environment:
  GITLAB_OMNIBUS_CONFIG: |
    external_url ‘http://192.168.10.10‘
    gitlab_rails[‘gitlab_shell_ssh_port‘] = 2222
   # Add any other gitlab.rb configuration here, each on its own line
volumes:
  - ‘/opt/gitlab/config:/etc/gitlab‘
  - ‘/opt/gitlab/logs:/var/log/gitlab‘
  - ‘/opt/gitlab/data:/var/opt/gitlab‘
ports:
  - 80:80

- 443:443

  - ‘2222:22‘
networks:
  - gitlab

networks:
gitlab:
driver: bridge
name: gitlab

* 备份gitlab
```bash
docker exec -t gitlab gitlab-rake gitlab:backup:create CRON=1
  • 恢复gitlab
    • 重新部署gitlab,并且新的gitlab版本必须与旧的gitlab一致
    • 复制备份到gitlab的backup目录
      cp 1550764828_2019_02_21_11.7.5_gitlab_backup.tar /opt/gitlab/data/backups/
      chmod +r /opt/gitlab/data/backups/ 1550764828_2019_02_21_11.7.5_gitlab_backup.tar 
    • 恢复gitlab
      docker exec -it gitlab  gitlab-rake gitlab:backup:restore

以上是关于docker 部署的gitlab备份与恢复的主要内容,如果未能解决你的问题,请参考以下文章

gitlab部署使用备份与恢复

Gitlab---代码库备份的迁移与数据恢复

docker gitlab迁移 备份 部署 搭建以及各种问题

GIT系列——GitLab备份与恢复

GIT系列——GitLab备份与恢复

Gitlab的备份与恢复