1、拉取gitlab-ce
docker pull gitlab/gitlab-ce:latest
2、在宿主机创建挂载目录
mkdir -p /apps/docker/gitlab/config
mkdir -p /apps/docker/gitlab/logs
mkdir -p /apps/docker/gitlab/data
3、启动容器
docker run -p 8083:80 -p 8070:443 -p 8084:22 -v /apps/docker/gitlab/config:/etc/gitlab -v /apps/docker/gitlab/logs:/var/log/gitlab -v /apps/docker/gitlab/data:/var/opt/gitlab -v /etc/localtime:/etc/localtime:ro -e TZ="Asia/Shanghai" --name=gitlab --privileged=true gitlab/gitlab-ce:latest
4、在/apps/docker/gitlab/config中修改gitlab的配置
vim /etc/gitlab/gitlab.rb
gitlab_rails[‘time_zone’] = ‘UTC’#修改后gitlab_rails[‘time_zone’] = ‘Asia/Shanghai’
docker restart containerid
5、不要关闭宿主机防火墙,否则启动不起来