1.获取镜像
# docker pull beginor/gitlab-ce:11.0.1-ce.0
2.创建目录
# mkdir -p /opt/gitlab/etc
# mkdir -p /opt/gitlab/log
# mkdir -p /opt/gitlab/data
3.创建容器
# docker run \
--detach \
--publish 443:443 \
--publish 80:80 \
--name gitlab \
--restart unless-stopped \
-v /etc/localtime:/etc/localtime \
-v /opt/gitlab/etc:/etc/gitlab \
-v /opt/gitlab/log:/var/log/gitlab \
-v /opt/gitlab/data:/var/opt/gitlab \
beginor/gitlab-ce:11.0.1-ce.0
4.把external_url改成部署机器的域名或者IP地址
# vim /opt/gitlab/etc/gitlab.rb
修改为如下:
external_url 'http://192.168.164.158'
5.将host的值改成映射的外部主机ip地址和端口
# vim /opt/gitlab/data/gitlab-rails/etc/gitlab.yml
修改成如下:
## Web server settings (note: host is the FQDN, do not include http://)
host: 192.168.164.158
port: 80
https: false
6.重启服务使修改生效
# docker exec -ti gitlab /bin/bash
# gitlab-ctl reconfigure
# gitlab-ctl restart
# gitlab-ctl status
7.打开浏览器,输入本机的ip地址并登陆
http://192.168.164.158
注:默认帐户的用户名是root,第一次访问时,将被重定向到密码重置屏幕,登录后,您可以更改用户名。
标签:opt,--,gitlab,192.168,etc,docker,安装 From: https://www.cnblogs.com/wuxinchun/p/16793929.html