构建HTTP GitLab

  1. version: '3.7'
  2. services:
  3. web:
  4. image: 'gitlab/gitlab-ce:latest'
  5. restart: always
  6. hostname: '192.168.1.150'
  7. environment:
  8. TZ: 'Asia/Shanghai'
  9. GITLAB_OMNIBUS_CONFIG: |
  10. external_url 'http://gitlab.hzlim.cn:8080'
  11. gitlab_rails['gitlab_shell_ssh_port'] = 2222
  12. nginx['listen_port'] = 8080
  13. ports:
  14. - '8080:8080'
  15. - '2222:22'
  16. volumes:
  17. - ./config:/etc/gitlab
  18. - ./data:/var/opt/gitlab
  19. - ./logs:/var/log/gitlab

构建HTTPS GitLab

  1. version: '3.7'
  2. services:
  3. web:
  4. image: 'gitlab/gitlab-ce:latest'
  5. restart: always
  6. hostname: '192.168.1.150'
  7. environment:
  8. TZ: 'Asia/Shanghai'
  9. GITLAB_OMNIBUS_CONFIG: |
  10. external_url 'https://gitlab.hzlim.cn:8443'
  11. gitlab_rails['gitlab_shell_ssh_port'] = 2222
  12. nginx['listen_port'] = 8443
  13. nginx['redirect_http_to_https'] = true
  14. nginx['ssl_certificate'] = "/etc/gitlab/cert/server.crt"
  15. nginx['ssl_certificate_key'] = "/etc/gitlab/cert/server.key"
  16. ports:
  17. - '8443:8443'
  18. - '2222:22'
  19. volumes:
  20. - ./cert:/etc/gitlab/cert
  21. - ./config:/etc/gitlab
  22. - ./data:/var/opt/gitlab
  23. - ./logs:/var/log/gitl