官方文档
https://docs.gitlab.com/ee/install/docker.html
编写docker-compose文件
version: '3.6'
services:
web:
image: 'gitlab/gitlab-ee:latest'
restart: always
hostname: '192.168.31.160'
ports:
- '5111:80'
- '2224:22'
- '2443:443'
volumes:
- /home/software/gitlab/config:/etc/gitlab:rw
- /home/software/gitlab/logs:/var/log/gitlab:rw
- /home/software/gitlab/data:/var/opt/gitlab:rw
privileged: true
shm_size: '256m'
启动脚本start.sh
sudo docker-compose -f /home/software/gitlab/docker-compose-gitlab.yml down;
sudo docker-compose -f /home/software/gitlab/docker-compose-gitlab.yml up -d --build;
改变clone http端口
- 默认生成的仓库地址是80端口,我们将他改为我们自己的端口 5111
找到配置文件
- 由于我们映射出来了,所以文件在/home/software/gitlab/config/gitlab.rb
- 更改以下内容
- external_url 'http://192.168.31.160:5111'
- nginx['listen_port'] = 80
- registry_nginx['listen_port'] = 80
为什么要改为80?
- 采坑;因为如果不改80,那么gitlab配置时会将nginx的配置监听端口也改为5111,而我们创建容器时映射到的是容器80端口,所以就会导致访问不到gitlab服务了;将这里改为80后,gitlab就会采用我们配置的80端口,这样能解决改了external_url后gitlab服务找不到的情况
重新加载配置
docker exec -it 容器名称 /bin/bash gitlab-ctl reconfigure
标签:私有,gitlab,端口,home,docker,80,software
From: https://www.cnblogs.com/nanxhs/p/17434619.html