1、安裝docker-compose步驟可參考本博客其餘文章nginx
2、這裏的ssl證書是使用letsencrypt生成,
可參考文檔https://my.oschina.net/u/3042999/blog/1858891git
https://wzfou.com/letsencrypt/sql
3、建立容器網絡
docker network create netgitlabdocker
4、docker-compose.yml文件以下,注意由於我這裏啓用了https,且使用的是非標準443端口,故須要shell
在external_url參數的域名後帶上端口號,注意須要把非標準的端口號暴露出來,即3001:3001 如不在域名後面帶上端口,能夠傳入參數:nginx['listen_port'] = 端口號,來指定nginx的監聽端口 值得注意的是不要忘記將自定義端口號進行映射,如使用非標準的80或443端口,不按照上述方式配置 在git clone界面域名以後將不帶端口號,配置正確以下圖所示
[root@hadoop01 gitlab]# more docker-compose.yml version: "2.4" networks: netgitlab: external: true services: ol-gitlab: image: gitlab/gitlab-ce:11.11.0-ce.0 container_name: ol-gitlab hostname: ol-gitlab ports: - "3088:80" - "3001:3001" - "10022:22" networks: - netgitlab volumes: - "/etc/localtime:/etc/localtime" - "./config:/etc/gitlab" - "./logs:/var/log/gitlab" - "./data:/var/opt/gitlab" - "./data/gitlab-backup:/data/gitlab-backup" environment: GITLAB_OMNIBUS_CONFIG: | unicorn['worker_timeout'] = 60 unicorn['worker_processes'] = 5 unicorn['worker_memory_limit_min'] = "200 * 1 << 20" unicorn['worker_memory_limit_max'] = "300 * 1 << 20" sidekiq['concurrency'] = 10 external_url 'https://git.xxxxx.com:3001' gitlab_rails['backup_path'] = "/data/gitlab-backup" gitlab_rails['backup_keep_time'] = 1296000 gitlab_rails['time_zone'] = 'Asia/Shanghai' gitlab_rails['backup_archive_permissions'] = 0644 gitlab_rails['gitlab_shell_ssh_port'] = 10022 nginx['enable'] = true nginx['client_max_body_size'] = '10240m' nginx['redirect_http_to_https'] = true nginx['ssl_certificate'] = "/etc/gitlab/ssl/fullchain.cer" nginx['ssl_certificate_key'] = "/etc/gitlab/ssl/git.xxxx.com.key" nginx['ssl_ciphers'] = "ECDHE-RSA-AES256-GCM-SHA384:ECDHE-RSA-AES128-GCM-SHA256" nginx['ssl_prefer_server_ciphers'] = "on" nginx['ssl_protocols'] = "TLSv1.1 TLSv1.2" nginx['ssl_session_cache'] = "builtin:1000 shared:SSL:10m" nginx['listen_addresses'] = ["0.0.0.0"] nginx['http2_enabled'] = true postgresql['max_worker_processes'] = 8 postgresql['shared_buffers'] = "256MB" mem_limit: 4096m restart: always user: root
啓動容器並拉取相關鏡像bash
docker-compose up -d
這裏使用docker-compose部署的優勢在於方便gitlab後期版本升級,只須要替換images鏡像地址重建容器便可,且數據遷移方便網絡
參考:https://blog.51cto.com/191226139/2362894session