docker-compose部署gitlab(亲测有效)
一.通过DockerHub拉取Gitlab镜像
docker pull gitlab/gitlab-ce:latest
二.创建目录
mkdir -p /root/tool/gitlab/{data,logs,config} && cd /root/tool/gitlab/
三.编辑DockerCompose.yaml文件
vim /root/tool/gitlab/docker-compose.yml
version: "3"
services:gitlab:container_name: gitlabimage: gitlab/gitlab-ce:latesthostname: '192.168.199.103'restart: alwaysports:- 8011:8011- 8443:443- 2222:22/tcpvolumes:- /etc/localtime:/etc/localtime- /root/tool/gitlab/data:/var/opt/gitlab- /root/tool/gitlab/config:/etc/gitlab- /root/tool/gitlab/logs:/var/log/gitlabenvironment:GITLAB_OMNIBUS_CONFIG: |external_url 'http://192.168.199.103:8011'gitlab_rails['gitlab_shell_ssh_port'] = 2222
四.使用DockerCompose快速部署Gitlab
docker compose up -d
五.访问Gitlab仓库
六.登录密码(root)
/root/tool/gitlab/config/initial_root_password
七.登录