GitLab CI/CD Complete Stack
Self-hosted GitLab with integrated CI/CD runners, container registry, and monitoring
Overview
GitLab is a complete DevOps platform that originated in 2011 as a self-hosted Git repository manager and evolved into a comprehensive solution covering the entire software development lifecycle. Unlike distributed DevOps toolchains requiring integration between multiple vendors, GitLab provides source code management, CI/CD pipelines, container registry, issue tracking, security scanning, and monitoring in a unified platform. This makes it particularly valuable for organizations seeking to reduce tool sprawl and streamline their development workflow. This stack combines GitLab's core platform with dedicated GitLab Runners for CI/CD execution, MinIO for S3-compatible artifact storage, and built-in Prometheus and Grafana integration for comprehensive monitoring. The multiple runner configuration provides concurrent job execution and fault tolerance, while MinIO handles large artifact storage requirements that would otherwise burden GitLab's main storage. This architecture creates a production-grade CI/CD environment capable of handling enterprise workloads with proper resource allocation and monitoring visibility. Development teams, DevOps engineers, and organizations transitioning from hosted solutions like GitHub Actions or Jenkins will find this stack provides enterprise-level capabilities with complete data sovereignty. The integrated monitoring through Prometheus and Grafana offers insights into both GitLab performance and CI/CD pipeline metrics, making it ideal for teams that need visibility into their development infrastructure performance and want to optimize build times and resource utilization.
Key Features
- Complete DevOps platform with integrated Git repositories, issue tracking, merge requests, and wiki documentation
- Built-in CI/CD pipelines with YAML configuration supporting complex workflows, parallel jobs, and deployment strategies
- Integrated Docker container registry for storing and managing application images with vulnerability scanning
- Multiple GitLab Runner instances providing concurrent job execution and high availability for CI/CD workloads
- MinIO S3-compatible storage backend for GitLab artifacts, uploads, and Git LFS objects
- Built-in Prometheus monitoring with GitLab-specific metrics and performance insights
- Integrated Grafana dashboards for visualizing GitLab performance, runner utilization, and pipeline metrics
- Auto DevOps capabilities with automatic CI/CD pipeline generation based on detected project types
Common Use Cases
- 1Enterprise software development teams needing complete DevOps platform with on-premises data control
- 2Organizations migrating from Jenkins or GitHub Actions seeking integrated CI/CD with better pipeline visualization
- 3Development teams requiring private container registry alongside their source code and CI/CD infrastructure
- 4Companies building microservices architectures needing coordinated multi-project CI/CD with shared runners
- 5DevOps teams implementing GitOps workflows with integrated monitoring and alerting capabilities
- 6Educational institutions teaching DevOps practices with a complete, self-contained development platform
- 7Startups and small companies wanting enterprise-grade DevOps tools without SaaS subscription costs
Prerequisites
- Minimum 8GB RAM recommended for GitLab, with additional 2GB for runners and monitoring components
- Docker and Docker Compose installed with at least 50GB available disk space for repositories and artifacts
- Ports 80, 443, 22, 5050, 9000, and 9001 available for GitLab, registry, and MinIO access
- Understanding of Git workflows, CI/CD concepts, and Docker containerization principles
- Basic knowledge of YAML for GitLab CI pipeline configuration and Docker Compose management
- Familiarity with Prometheus metrics and Grafana dashboard concepts for monitoring setup
For development & testing. Review security settings, change default credentials, and test thoroughly before production use. See Terms
docker-compose.yml
docker-compose.yml
1services: 2 gitlab: 3 image: gitlab/gitlab-ee:latest4 container_name: gitlab5 restart: unless-stopped6 hostname: gitlab.local7 ports: 8 - "${HTTP_PORT:-80}:80"9 - "${HTTPS_PORT:-443}:443"10 - "${SSH_PORT:-22}:22"11 volumes: 12 - gitlab_config:/etc/gitlab13 - gitlab_logs:/var/log/gitlab14 - gitlab_data:/var/opt/gitlab15 environment: 16 GITLAB_OMNIBUS_CONFIG: |17 external_url 'http: //${GITLAB_HOST:-localhost}'18 gitlab_rails['gitlab_shell_ssh_port'] = ${SSH_PORT: -22}19 registry_external_url 'http: //${REGISTRY_HOST:-registry.localhost}:5050'20 prometheus_monitoring['enable'] = true21 grafana['enable'] = true22 shm_size: '256m'2324 gitlab-runner: 25 image: gitlab/gitlab-runner:latest26 container_name: gitlab-runner27 restart: unless-stopped28 volumes: 29 - ./runner-config:/etc/gitlab-runner30 - /var/run/docker.sock:/var/run/docker.sock31 depends_on: 32 - gitlab3334 gitlab-runner-2: 35 image: gitlab/gitlab-runner:latest36 container_name: gitlab-runner-237 restart: unless-stopped38 volumes: 39 - ./runner-config-2:/etc/gitlab-runner40 - /var/run/docker.sock:/var/run/docker.sock41 depends_on: 42 - gitlab4344 minio: 45 image: minio/minio:latest46 container_name: gitlab-minio47 restart: unless-stopped48 ports: 49 - "${MINIO_PORT:-9000}:9000"50 - "${MINIO_CONSOLE:-9001}:9001"51 environment: 52 - MINIO_ROOT_USER=${MINIO_USER:-minioadmin}53 - MINIO_ROOT_PASSWORD=${MINIO_PASSWORD:-minioadmin}54 volumes: 55 - minio_data:/data56 command: server /data --console-address ":9001"5758volumes: 59 gitlab_config: 60 gitlab_logs: 61 gitlab_data: 62 minio_data: .env Template
.env
1# GitLab Complete Stack2HTTP_PORT=803HTTPS_PORT=4434SSH_PORT=225MINIO_PORT=90006MINIO_CONSOLE=900178# GitLab9GITLAB_HOST=gitlab.localhost10REGISTRY_HOST=registry.localhost1112# MinIO for artifacts storage13MINIO_USER=minioadmin14MINIO_PASSWORD=minioadminUsage Notes
- 1GitLab at http://localhost (first boot takes 5-10 minutes)
- 2Initial root password in: docker exec gitlab cat /etc/gitlab/initial_root_password
- 3Register runners: docker exec gitlab-runner gitlab-runner register
- 4Container registry at port 5050
- 5MinIO provides S3-compatible artifact storage
- 6Configure GitLab to use MinIO for artifacts, uploads, LFS
Individual Services(4 services)
Copy individual services to mix and match with your existing compose files.
gitlab
gitlab:
image: gitlab/gitlab-ee:latest
container_name: gitlab
restart: unless-stopped
hostname: gitlab.local
ports:
- ${HTTP_PORT:-80}:80
- ${HTTPS_PORT:-443}:443
- ${SSH_PORT:-22}:22
volumes:
- gitlab_config:/etc/gitlab
- gitlab_logs:/var/log/gitlab
- gitlab_data:/var/opt/gitlab
environment:
GITLAB_OMNIBUS_CONFIG: |
external_url 'http://${GITLAB_HOST:-localhost}'
gitlab_rails['gitlab_shell_ssh_port'] = ${SSH_PORT:-22}
registry_external_url 'http://${REGISTRY_HOST:-registry.localhost}:5050'
prometheus_monitoring['enable'] = true
grafana['enable'] = true
shm_size: 256m
gitlab-runner
gitlab-runner:
image: gitlab/gitlab-runner:latest
container_name: gitlab-runner
restart: unless-stopped
volumes:
- ./runner-config:/etc/gitlab-runner
- /var/run/docker.sock:/var/run/docker.sock
depends_on:
- gitlab
gitlab-runner-2
gitlab-runner-2:
image: gitlab/gitlab-runner:latest
container_name: gitlab-runner-2
restart: unless-stopped
volumes:
- ./runner-config-2:/etc/gitlab-runner
- /var/run/docker.sock:/var/run/docker.sock
depends_on:
- gitlab
minio
minio:
image: minio/minio:latest
container_name: gitlab-minio
restart: unless-stopped
ports:
- ${MINIO_PORT:-9000}:9000
- ${MINIO_CONSOLE:-9001}:9001
environment:
- MINIO_ROOT_USER=${MINIO_USER:-minioadmin}
- MINIO_ROOT_PASSWORD=${MINIO_PASSWORD:-minioadmin}
volumes:
- minio_data:/data
command: server /data --console-address ":9001"
Quick Start
terminal
1# 1. Create the compose file2cat > docker-compose.yml << 'EOF'3services:4 gitlab:5 image: gitlab/gitlab-ee:latest6 container_name: gitlab7 restart: unless-stopped8 hostname: gitlab.local9 ports:10 - "${HTTP_PORT:-80}:80"11 - "${HTTPS_PORT:-443}:443"12 - "${SSH_PORT:-22}:22"13 volumes:14 - gitlab_config:/etc/gitlab15 - gitlab_logs:/var/log/gitlab16 - gitlab_data:/var/opt/gitlab17 environment:18 GITLAB_OMNIBUS_CONFIG: |19 external_url 'http://${GITLAB_HOST:-localhost}'20 gitlab_rails['gitlab_shell_ssh_port'] = ${SSH_PORT:-22}21 registry_external_url 'http://${REGISTRY_HOST:-registry.localhost}:5050'22 prometheus_monitoring['enable'] = true23 grafana['enable'] = true24 shm_size: '256m'2526 gitlab-runner:27 image: gitlab/gitlab-runner:latest28 container_name: gitlab-runner29 restart: unless-stopped30 volumes:31 - ./runner-config:/etc/gitlab-runner32 - /var/run/docker.sock:/var/run/docker.sock33 depends_on:34 - gitlab3536 gitlab-runner-2:37 image: gitlab/gitlab-runner:latest38 container_name: gitlab-runner-239 restart: unless-stopped40 volumes:41 - ./runner-config-2:/etc/gitlab-runner42 - /var/run/docker.sock:/var/run/docker.sock43 depends_on:44 - gitlab4546 minio:47 image: minio/minio:latest48 container_name: gitlab-minio49 restart: unless-stopped50 ports:51 - "${MINIO_PORT:-9000}:9000"52 - "${MINIO_CONSOLE:-9001}:9001"53 environment:54 - MINIO_ROOT_USER=${MINIO_USER:-minioadmin}55 - MINIO_ROOT_PASSWORD=${MINIO_PASSWORD:-minioadmin}56 volumes:57 - minio_data:/data58 command: server /data --console-address ":9001"5960volumes:61 gitlab_config:62 gitlab_logs:63 gitlab_data:64 minio_data:65EOF6667# 2. Create the .env file68cat > .env << 'EOF'69# GitLab Complete Stack70HTTP_PORT=8071HTTPS_PORT=44372SSH_PORT=2273MINIO_PORT=900074MINIO_CONSOLE=90017576# GitLab77GITLAB_HOST=gitlab.localhost78REGISTRY_HOST=registry.localhost7980# MinIO for artifacts storage81MINIO_USER=minioadmin82MINIO_PASSWORD=minioadmin83EOF8485# 3. Start the services86docker compose up -d8788# 4. View logs89docker compose logs -fOne-Liner
Run this command to download and set up the recipe in one step:
terminal
1curl -fsSL https://docker.recipes/api/recipes/gitlab-cicd-complete/run | bashTroubleshooting
- GitLab 502 error on startup: Wait 10-15 minutes for complete initialization, check docker logs gitlab for 'GitLab Workhorse started' message
- Runners failing to connect: Verify runner registration token from GitLab admin area and ensure Docker socket permissions allow runner containers to spawn jobs
- Container registry push failures: Check that external registry URL matches your domain configuration and port 5050 is accessible from client machines
- MinIO connection errors in GitLab: Verify MINIO_ROOT_USER and MINIO_ROOT_PASSWORD match GitLab's object storage configuration in omnibus settings
- High memory usage and OOM kills: Increase shared memory size beyond 256m and allocate at least 8GB system RAM for GitLab container
- Prometheus metrics not appearing: Ensure prometheus_monitoring['enable'] = true in GitLab configuration and restart container to apply omnibus changes
Community Notes
Loading...
Loading notes...
Download Recipe Kit
Get all files in a ready-to-deploy package
Includes docker-compose.yml, .env template, README, and license
Components
gitlabgitlab-runnerregistryprometheusgrafana
Tags
#gitlab#ci-cd#git#registry#runners#devops
Category
DevOps & CI/CDAd Space
Shortcuts: C CopyF FavoriteD Download