docker-compose配置
services:
gitlab:
image: gitlab/gitlab-ce:latest
container_name: gitlab
restart: always
hostname: 'gitlab.example.com'
environment:
GITLAB_OMNIBUS_CONFIG: |
# Add any other gitlab.rb configuration here, each on its own line
external_url 'https://gitlab.example.com'
ports:
- '8082:80'
- '8443:443'
- '2022:22'
volumes:
- '/data/gitlab/config:/etc/gitlab'
- '/data/gitlab/logs:/var/log/gitlab'
- '/data/gitlab/data:/var/opt/gitlab'
shm_size: '256m'
启动容器
docker-compose up -d
查看容器
# docker ps | grep gitlab
eaafea69b738 gitlab/gitlab-ce:latest "/assets/init-contai..." 8 minutes ago Up 5 minutes (healthy) 0.0.0.0:2022->22/tcp, :::2022->22/tcp, 0.0.0.0:8082->80/tcp, :::8082->80/tcp, 0.0.0.0:8443->443/tcp, :::8443->443/tcp gitlab
查看初始密码
cat config/initial_root_password
默认用户名:root
防火墙开放8443
firewall-cmd --add-port 8443/tcp
firewall-cmd --add-port 8443/tcp --permanent
参考