#创建目录
mkdir -p /root/docker/gitlab/config
mkdir -p /root/docker/gitlab/logs
mkdir -p /root/docker/gitlab/data
#设置权限
cd /root/docker/gitlab && chmod +777 *
#创建gitlab权限 hostname 访问域名,根据实际填写
docker run --detach --hostname 192.168.1.42 --publish 443:443 --publish 80:80 --publish 4988:22 --name gitlab --restart always --volume /root/docker/gitlab/config:/etc/gitlab --volume /root/docker/gitlab/logs:/var/log/gitlab --volume /root/docker/gitlab/data:/var/opt/gitlab --shm-size 256m gitlab/gitlab-ce:latest
#初始化root密码
docker exec -it gitlab grep 'Password:' /etc/gitlab/initial_root_password
#如果宿主机和容器的ssh端口不一致
docker exec -it gitlab /bin/bash
vi /etc/gitlab/gitlab.rb
#修改端口,并保存
gitlab_rails['gitlab_shell_ssh_port'] = 4988
#重启
gitlab-ctl reconfigure


关闭注册功能
?官方文档:GitLab Docker images | GitLab
|