[Docker]安装gitlab

1.下载gitlab

docker  pull  gitlab/gitlab-ce 

2.创建gitlab容器文件挂载的主机文件地址

mkdir  /opt/gitlab/conf

mkdir   /opt/gitlab/logs

mkdir   /opt/gitlab/data

3.编写脚本运行gitlab

#!/bin/bash

docker stop gitlab;

docker rm gitlab;

docker run -d \

-p 443:443 \

-p 465:465 \

-p 9001:80 \

-p 9002:22 \

-p 9000:9000 \

--restart always \

--name gitlab \

--hostname 36.139.115.199 \

-v /opt/gitlab/conf:/etc/gitlab \

-v /opt/gitlab/logs:/var/log/gitlab \

-v /opt/gitlab/data:/var/opt/gitlab \

--privileged=true \

--shm-size 256m \

gitlab/gitlab-ce

sh start.sh 即可运行gitlab

4.修改gitlab的配置文件

vim  /opt/gitlab/conf/gitlab.rb

external_url  'https://ip:8990'

nginx['redirect_http_to_https'] = true

puma['worker_processes'] = 2

 # 此端口是run时22端口映射的9002端口

gitlab_rails['gitlab_ssh_host'] = 'ip' 

gitlab_rails['gitlab_shell_ssh_port'] = 9002

gitlab_rails['smtp_enable'] = true

gitlab_rails['smtp_address'] = "smtp.qq.com"

gitlab_rails['smtp_port'] = 465

gitlab_rails['smtp_user_name'] = "[email protected]"

gitlab_rails['smtp_password'] = "QQ邮箱授权码(不是QQ邮箱的密码)"

gitlab_rails['smtp_domain'] = " smtp.qq.com"

gitlab_rails['smtp_authentication'] = "login"

gitlab_rails['smtp_enable_starttls_auto'] = true

gitlab_rails['smtp_tls'] = true

gitlab_rails['gitlab_email_from'] = '[email protected]'

gitlab_rails[‘gitlab_email_enabled’] = true

5.不更改启动配置的重启

docker stop gitlab

docker start gitlab

docker restart gitlab

你可能感兴趣的:([Docker]安装gitlab)