• 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