拉取最新gitlab-zh
docker pull twang2218/gitlab-ce-zh:10.8.1
安装docker-compose
sudo curl -L https://github.com/docker/compose/releases/download/1.21.2/docker-compose-$(uname -s)-$(uname -m) -o /usr/local/bin/docker-compose
sudo chmod +x /usr/local/bin/docker-compose
新建docker-compose.yml文件
version: '2'
services:
gitlab:
image: 'twang2218/gitlab-ce-zh:10.8.1'
restart: unless-stopped
hostname: 'gitlab.example.com'
environment:
TZ: 'Asia/Shanghai'
GITLAB_OMNIBUS_CONFIG: |
external_url 'http://gitlab.example.com'
gitlab_rails['time_zone'] = 'Asia/Shanghai'
# 需要配置到 gitlab.rb 中的配置可以在这里配置,每个配置一行,注意缩进。
# 比如下面的电子邮件的配置:
# gitlab_rails['smtp_enable'] = true
# gitlab_rails['smtp_address'] = "smtp.exmail.qq.com"
# gitlab_rails['smtp_port'] = 465
# gitlab_rails['smtp_user_name'] = "xxxx@xx.com"
# gitlab_rails['smtp_password'] = "password"
# gitlab_rails['smtp_authentication'] = "login"
# gitlab_rails['smtp_enable_starttls_auto'] = true
# gitlab_rails['smtp_tls'] = true
# gitlab_rails['gitlab_email_from'] = 'xxxx@xx.com'
ports:
- '80:80'
- '443:443'
- '22:22'
volumes:
- '/mnt/data/gitlab/config:/etc/gitlab'
- '/mnt/data/gitlab/logs:/var/log/gitlab'
- '/mnt/data/gitlab/data:/var/opt/gitlab'
启动gitlab
docker-compose up -d -f docker-compose.yml
停止gitlab
docker-compose down -f docker-compose.yml
防火墙添加过滤
sudo firewall-cmd --permanent --add-service=http
sudo systemctl reload firewalld
如有错误,欢迎指出。