Docker-compose一键部署gitlab
创建配置文件
mkdir -p /usr/local/docker/gitlab
cat > /usr/local/docker/gitlab/docker-compose.yml<<'EOF'
version: '3'
services:
web:
# 镜像名称
image: 'twang2218/gitlab-ce-zh'
# 容器名字 docker run --name
container_name: gitlab
# 开机自动重启
restart: always
# 服务器IP地址 FQDN
hostname: '10.1.30.108'
environment:
TZ: 'Asia/Shanghai'
GITLAB_OMNIBUS_CONFIG: |
external_url 'http://10.1.30.108'
gitlab_rails['gitlab_shell_ssh_port'] = 2222
unicorn['port'] = 8888
nginx['listen_port'] = 80
ports:
- '80:80'
- '443:443'
- '2222:22'
volumes:
- ./config:/etc/gitlab
- ./data:/var/opt/gitlab
- ./logs:/var/log/gitlab
EOF
cd /usr/local/docker/gitlab
docker-compose up -d
[root@SaaS gitlab]# docker ps -a
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
13edb02a4596 twang2218/gitlab-ce-zh "/assets/wrapper" About an hour ago Up About an hour (healthy) 0.0.0.0:80->80/tcp, 0.0.0.0:443->443/tcp, 0.0.0.0:2222->22/tcp gitlab
END