- 从仓库拉取最新的gitlab版本
docker pull gitlab/gitlab-ce 这个不好用,会无限重启,使用下面的指令
docker search gitlab
docker pull twang2218/gitlab-ce-zh
- 创建对应的文件夹
mkdir /home/data/gitlab/config
mkdir /home/data/gitlab/data
mkdir /home/data/gitlab/logs
- 运行镜像
sudo docker run --name zngitlab -d \
--hostname 192.168.11.45 \
-v /Users/admin/dev/zngitlab/config:/etc/gitlab \
-v /Users/admin/dev/zngitlab/data:/var/opt/gitlab \
-v /Users/admin/dev/zngitlab/logs:/var/log/gitlab \
-p 12222:22 -p 12345:80 -p 18433:433 \
--restart always \
--privileged=true \
twang2218/gitlab-ce-zh
配置邮箱smtp
/Users/admin/dev/zngitlab/config/gitlab.rb
gitlab_rails['gitlab_email_from'] = 'xxxxx@163.com'
gitlab_rails['gitlab_email_reply_to'] = 'xxxxx@163.com'
user['git_user_email'] = "xxxxx@163.com"
gitlab_rails['smtp_enable'] = true
gitlab_rails['smtp_address'] = "smtp.163.com"
gitlab_rails['smtp_port'] = 25
gitlab_rails['smtp_user_name'] = "xxxxx@163.com"
gitlab_rails['smtp_password'] = "163邮箱的授权码"
gitlab_rails['smtp_domain'] = "163.com"
gitlab_rails['smtp_authentication'] = "login"
gitlab_rails['smtp_enable_starttls_auto'] = true
重新配置后生效
gitlab-ctl reconfigure
测试邮箱功能
gitlab-rails console
# liuri@lemonit.cn换成你要实际发送测试邮件的目标邮箱地址
Notify.test_email('liuri@lemonit.cn', 'LemonITCN', 'LemonITCN').deliver_now