GitLab容器化部署方法
一 准备与规划
二 部署方式
mkdir -p /data/gitlab/{config,logs,data}
cat > /data/gitlab/docker-compose.yml <<'EOF'
version: '3.6'
services:
gitlab:
image: gitlab/gitlab-ce:latest
container_name: gitlab
restart: always
hostname: gitlab.example.com
environment:
GITLAB_OMNIBUS_CONFIG: |
external_url 'http://gitlab.example.com:5480'
gitlab_rails['gitlab_shell_ssh_port'] = 5022
ports:
- '5480:80'
- '5443:443'
- '5022:22'
volumes:
- /data/gitlab/config:/etc/gitlab
- /data/gitlab/logs:/var/log/gitlab
- /data/gitlab/data:/var/opt/gitlab
shm_size: '256m'
EOF
cd /data/gitlab
docker-compose up -d
docker-compose logs -f
docker run -d \
--hostname gitlab.example.com \
--publish 5480:80 --publish 5443:443 --publish 5022:22 \
--name gitlab \
--restart always \
--volume /data/gitlab/config:/etc/gitlab \
--volume /data/gitlab/logs:/var/log/gitlab \
--volume /data/gitlab/data:/var/opt/gitlab \
--shm-size 256m \
gitlab/gitlab-ce:latest
三 关键配置
四 安全与运维
五 常见问题与排错