- 拉取鏡像
docker pull store/gitlab/gitlab-ce:11.10.4-ce.0
- 打標簽
docker tag docker:store/gitlab/gitlab-ce:11.10.4-ce.0 docker:ce
- 打容器
docker run
--detach
--hostname 192.168.1.102 //本地ip
--publish 1111:1111 //訪問端口
--publish 1122:22 //ssh端口
--name gitlab
--restart always
gitlab:ce
此時訪問http://192.168.1.102:1111是打不開的 還需配置:
- 修改配置文件
docker exec -it [id] bash
vi /etc/gitlab/gitlab.rb
- 修改external_url屬性為
external_url "http://192.168.0.102:1111"
- 修改gitlab_shell_ssh_port為
gitlab_rails['gitlab_shell_ssh_port'] = 1122
- 保存 退出
- 重啟gitlab容器
docker restart [id]
- sucess