1. 程式人生 > >docker 部署的gitlab備份與恢復

docker 部署的gitlab備份與恢復

文件 create art cron ont extern var containe 版本

  • 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備份與恢復