1 关闭防火墙

# 关闭
 systemctl stop firewalld
 # 禁止开机启动防火墙
 systemctl disable firewalld

2 拉镜像

# 搜索镜像
docker search gitlab
# 拉镜像
docker pull gitlab/gitlab-ce
# 查看镜像
docker images

3 编写docker-compose.yml

IP改为自己机器IP

version: '3.1' 
services: 
  gitlab: 
    image: 'gitlab/gitlab-ce:latest'
    container_name: gitlab
    hostname: '192.168.52.90'
    restart: always
    environment: 
      GITLAB_OMNIBUS_CONFIG: |
        external_url '<http://192.168.52.90:8929>'
        gitlab_rails['gitlab_shell_ssh_port'] = 2224
    ports: 
      - '8929:8929'
      - '2224:22'
    volumes: 
      - './config:/etc/gitlab'
      - './logs:/var/log/gitlab'
      - './data:/var/opt/gitlab'
# 重启docker
systemctl restart docker
# 启动docker-compose
docker-compose up -d

# gitlab-ce 初装以后,把密码放在了一个临时文件中了
cat /etc/gitlab/initial_root_password

4 问题以及解决方案

Untitled

# 进入gitlab容器内部
docker exec -it gitlab bash
# 修改配置文件
vi /etc/gitlab/gitlab.rb
# 开放配置文件中的注释
puma['worker_timeout'] = 60

gitlab-ctl reconfigure

gitlab-ctl restart