一、拉取 Gitlab 镜像
docker pull twang2218/gitlab-ce-zh:11.1.4
二、编写 docker-compose 配置
1、创建 Gitlab 安装位置:
mkdir -p /home/docker_app/gitlab && cd /home/docker_app/gitlab
2、创建 docker-compose.yml 文件:
version: '3'
services:
gitlab:
image: 'twang2218/gitlab-ce-zh:11.1.4'
restart: unless-stopped
hostname: 'xxx.xxx.xxx.xxx'
environment:
TZ: 'Asia/Shanghai'
GITLAB_OMNIBUS_CONFIG: |
external_url 'http://xxx.xxx.xxx.xxx:7070'
gitlab_rails['gitlab_shell_ssh_port'] = '7022'
gitlab_rails['time_zone'] = 'Asia/Shanghai'
unicorn['port'] = 8888
nginx['listen_port'] = 7070
ports:
- '7070:7070'
- '7443:443'
- '7022:22'
volumes:
- /home/docker_app/gitlab/config:/etc/gitlab
- /home/docker_app/gitlab/data:/var/opt/gitlab
- /home/docker_app/gitlab/logs:/var/log/gitlab
3、启动容器
docker-compose up -d