一、安裝GitLab
docker run -d
-h git.test.com
-p 80:80
-p 443:443
-p 22:22
-v /www/wwwroot/git.test.com/gitlab/config:/etc/gitlab:rw
-v /www/wwwroot/git.test.com/gitlab/data:/var/opt/gitlab:rw
-v /www/wwwroot/git.test.com/gitlab/logs:/var/log/gitlab:rw
-v /www/server/panel/vhost/cert/git.test.com:/gitlab_ssl:ro
--restart=always --name server-gitlab gitlab/gitlab-ce:latest
二、GitLab啟用SSL
- 進入容器
docker exec -it server-gitlab /bin/bash
- 修改配置檔案:vim /etc/gitlab/gitlab.rb
external_url "https://git.test.com"
nginx['enable'] = true
nginx['redirect_http_to_https'] = true
nginx['ssl_certificate'] = "/gitlab_ssl/fullchain.pem"
nginx['ssl_certificate_key'] = "/gitlab_ssl/privkey.pem"
三、GITLab配置SMTP伺服器
- 配置郵件伺服器
gitlab_rails['smtp_enable'] = true
gitlab_rails['smtp_address'] = "smtp.163.com"
gitlab_rails['smtp_port'] = 465
gitlab_rails['smtp_user_name'] = "xxuser@163.com"
gitlab_rails['smtp_password'] = "xxpassword"
gitlab_rails['smtp_domain'] = "163.com"
gitlab_rails['smtp_authentication'] = "login"
gitlab_rails['smtp_enable_starttls_auto'] = true
- 配置發信人
gitlab_rails['gitlab_email_from'] = "xxuser@163.com"
user["git_user_email"] = "xxuser@163.com"
四、重新生成配置並重啟GitLab
# 重新生成配置
gitlab-ctl reconfigure
# 重啟GitLab
gitlab-ctl restart
原文:https://www.xqitw.cn/docker-gitlab.html
本作品採用《CC 協議》,轉載必須註明作者和本文連結