GitLab CE Complete Stack
Self-hosted GitLab Community Edition with integrated CI/CD and container registry.
Overview
GitLab Community Edition is a comprehensive DevOps platform that combines source code management, continuous integration/continuous deployment (CI/CD), container registry, and project management in a single application. Originally launched in 2011 as an open-source alternative to proprietary Git hosting solutions, GitLab CE has evolved into a complete software development lifecycle platform that rivals enterprise solutions while remaining free and self-hosted. Unlike cloud-based alternatives, GitLab CE gives organizations complete control over their code, data, and development processes.
This stack combines GitLab CE with PostgreSQL for robust data storage, Redis for high-performance caching and session management, and GitLab Runner for executing CI/CD pipelines. PostgreSQL handles GitLab's complex relational data including user accounts, project metadata, merge requests, and issue tracking, while Redis accelerates the platform by caching frequently accessed data and managing real-time features like notifications and live updates. GitLab Runner provides the compute engine for automated testing, building, and deployment workflows, creating a complete DevOps automation environment.
This configuration is ideal for development teams, startups, and organizations seeking enterprise-grade DevOps capabilities without vendor lock-in or subscription costs. Teams migrating from GitHub Enterprise, Bitbucket Server, or Jenkins-based workflows will find GitLab CE provides integrated functionality that eliminates the need for multiple disparate tools. The stack is particularly valuable for security-conscious organizations requiring on-premises code hosting and for teams implementing GitOps practices with built-in container registry and Kubernetes integration.
Key Features
- Complete Git repository hosting with advanced branch protection and merge request workflows
- Integrated CI/CD pipelines with Docker-based runners and parallel job execution
- Built-in container registry supporting Docker images with vulnerability scanning
- Comprehensive project management including issues, milestones, epics, and Kanban boards
- Auto DevOps capabilities with automatic testing, security scanning, and deployment
- Wiki and documentation system with Markdown support and version control
- Advanced user management with LDAP/SAML integration and role-based permissions
- Built-in monitoring and analytics with deployment frequency and lead time metrics
Common Use Cases
- 1Enterprise teams transitioning from GitHub Enterprise or Bitbucket Server to self-hosted Git
- 2Development organizations implementing comprehensive DevSecOps with integrated security scanning
- 3Startups requiring complete DevOps platform without per-user licensing costs
- 4Educational institutions teaching software development with full project lifecycle tools
- 5Open source projects needing advanced CI/CD capabilities beyond basic Git hosting
- 6Companies in regulated industries requiring on-premises code and artifact storage
- 7Teams practicing GitOps with Kubernetes deployments and infrastructure as code
Prerequisites
- Minimum 8GB RAM recommended (GitLab CE requires 4GB+ alone)
- At least 20GB available disk space for GitLab data, logs, and container registry
- Docker and Docker Compose installed with sufficient permissions
- Ports 80, 443, 2224, and 5050 available for web interface, SSH, and registry access
- Basic understanding of Git workflows and CI/CD concepts
- SMTP server credentials if email notifications are required
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-ce:latest4 container_name: gitlab5 hostname: gitlab.local6 environment: 7 GITLAB_OMNIBUS_CONFIG: |8 external_url '${GITLAB_EXTERNAL_URL}'9 gitlab_rails['gitlab_shell_ssh_port'] = 222410 registry_external_url '${REGISTRY_EXTERNAL_URL}'11 gitlab_rails['smtp_enable'] = true12 gitlab_rails['smtp_address'] = "${SMTP_HOST}"13 gitlab_rails['smtp_port'] = ${SMTP_PORT}14 gitlab_rails['smtp_user_name'] = "${SMTP_USER}"15 gitlab_rails['smtp_password'] = "${SMTP_PASSWORD}"16 gitlab_rails['smtp_domain'] = "${SMTP_DOMAIN}"17 gitlab_rails['smtp_authentication'] = "login"18 gitlab_rails['smtp_enable_starttls_auto'] = true19 prometheus_monitoring['enable'] = false20 puma['worker_processes'] = 221 sidekiq['max_concurrency'] = 1022 ports: 23 - "80:80"24 - "443:443"25 - "2224:22"26 - "5050:5050"27 volumes: 28 - gitlab-config:/etc/gitlab29 - gitlab-logs:/var/log/gitlab30 - gitlab-data:/var/opt/gitlab31 shm_size: '256m'32 networks: 33 - gitlab-network34 restart: unless-stopped3536 gitlab-runner: 37 image: gitlab/gitlab-runner:latest38 container_name: gitlab-runner39 volumes: 40 - gitlab-runner-config:/etc/gitlab-runner41 - /var/run/docker.sock:/var/run/docker.sock42 depends_on: 43 - gitlab44 networks: 45 - gitlab-network46 restart: unless-stopped4748volumes: 49 gitlab-config: 50 gitlab-logs: 51 gitlab-data: 52 gitlab-runner-config: 5354networks: 55 gitlab-network: 56 driver: bridge.env Template
.env
1# GitLab CE Complete2GITLAB_EXTERNAL_URL=http://gitlab.local3REGISTRY_EXTERNAL_URL=http://registry.gitlab.local:505045# SMTP Settings6SMTP_HOST=smtp.example.com7SMTP_PORT=5878SMTP_USER=gitlab@example.com9SMTP_PASSWORD=smtp_password10SMTP_DOMAIN=example.comUsage Notes
- 1GitLab at http://localhost
- 2Initial root password in /etc/gitlab/initial_root_password
- 3Register runner: gitlab-runner register
- 4Container registry at :5050
- 5Requires 4GB+ RAM minimum
Individual Services(2 services)
Copy individual services to mix and match with your existing compose files.
gitlab
gitlab:
image: gitlab/gitlab-ce:latest
container_name: gitlab
hostname: gitlab.local
environment:
GITLAB_OMNIBUS_CONFIG: |
external_url '${GITLAB_EXTERNAL_URL}'
gitlab_rails['gitlab_shell_ssh_port'] = 2224
registry_external_url '${REGISTRY_EXTERNAL_URL}'
gitlab_rails['smtp_enable'] = true
gitlab_rails['smtp_address'] = "${SMTP_HOST}"
gitlab_rails['smtp_port'] = ${SMTP_PORT}
gitlab_rails['smtp_user_name'] = "${SMTP_USER}"
gitlab_rails['smtp_password'] = "${SMTP_PASSWORD}"
gitlab_rails['smtp_domain'] = "${SMTP_DOMAIN}"
gitlab_rails['smtp_authentication'] = "login"
gitlab_rails['smtp_enable_starttls_auto'] = true
prometheus_monitoring['enable'] = false
puma['worker_processes'] = 2
sidekiq['max_concurrency'] = 10
ports:
- "80:80"
- "443:443"
- "2224:22"
- "5050:5050"
volumes:
- gitlab-config:/etc/gitlab
- gitlab-logs:/var/log/gitlab
- gitlab-data:/var/opt/gitlab
shm_size: 256m
networks:
- gitlab-network
restart: unless-stopped
gitlab-runner
gitlab-runner:
image: gitlab/gitlab-runner:latest
container_name: gitlab-runner
volumes:
- gitlab-runner-config:/etc/gitlab-runner
- /var/run/docker.sock:/var/run/docker.sock
depends_on:
- gitlab
networks:
- gitlab-network
restart: unless-stopped
Quick Start
terminal
1# 1. Create the compose file2cat > docker-compose.yml << 'EOF'3services:4 gitlab:5 image: gitlab/gitlab-ce:latest6 container_name: gitlab7 hostname: gitlab.local8 environment:9 GITLAB_OMNIBUS_CONFIG: |10 external_url '${GITLAB_EXTERNAL_URL}'11 gitlab_rails['gitlab_shell_ssh_port'] = 222412 registry_external_url '${REGISTRY_EXTERNAL_URL}'13 gitlab_rails['smtp_enable'] = true14 gitlab_rails['smtp_address'] = "${SMTP_HOST}"15 gitlab_rails['smtp_port'] = ${SMTP_PORT}16 gitlab_rails['smtp_user_name'] = "${SMTP_USER}"17 gitlab_rails['smtp_password'] = "${SMTP_PASSWORD}"18 gitlab_rails['smtp_domain'] = "${SMTP_DOMAIN}"19 gitlab_rails['smtp_authentication'] = "login"20 gitlab_rails['smtp_enable_starttls_auto'] = true21 prometheus_monitoring['enable'] = false22 puma['worker_processes'] = 223 sidekiq['max_concurrency'] = 1024 ports:25 - "80:80"26 - "443:443"27 - "2224:22"28 - "5050:5050"29 volumes:30 - gitlab-config:/etc/gitlab31 - gitlab-logs:/var/log/gitlab32 - gitlab-data:/var/opt/gitlab33 shm_size: '256m'34 networks:35 - gitlab-network36 restart: unless-stopped3738 gitlab-runner:39 image: gitlab/gitlab-runner:latest40 container_name: gitlab-runner41 volumes:42 - gitlab-runner-config:/etc/gitlab-runner43 - /var/run/docker.sock:/var/run/docker.sock44 depends_on:45 - gitlab46 networks:47 - gitlab-network48 restart: unless-stopped4950volumes:51 gitlab-config:52 gitlab-logs:53 gitlab-data:54 gitlab-runner-config:5556networks:57 gitlab-network:58 driver: bridge59EOF6061# 2. Create the .env file62cat > .env << 'EOF'63# GitLab CE Complete64GITLAB_EXTERNAL_URL=http://gitlab.local65REGISTRY_EXTERNAL_URL=http://registry.gitlab.local:50506667# SMTP Settings68SMTP_HOST=smtp.example.com69SMTP_PORT=58770SMTP_USER=gitlab@example.com71SMTP_PASSWORD=smtp_password72SMTP_DOMAIN=example.com73EOF7475# 3. Start the services76docker compose up -d7778# 4. View logs79docker 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-ce-complete/run | bashTroubleshooting
- GitLab container exits with 'not enough shared memory': Increase shm_size to 512m or higher in docker-compose.yml
- 502 Bad Gateway on initial startup: Wait 5-10 minutes for GitLab's internal services to fully initialize before accessing web interface
- GitLab Runner registration fails with SSL errors: Use gitlab.local hostname or configure proper SSL certificates in GitLab configuration
- Container registry push fails with authentication errors: Ensure registry_external_url matches your domain and GitLab is fully started
- High memory usage causing system slowdown: Reduce puma worker_processes and sidekiq max_concurrency in GitLab configuration
- SSH clone fails on port 2224: Verify SSH key is added to GitLab profile and git remote URL uses correct port
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
gitlab-cegitlab-runnerredispostgresql
Tags
#gitlab#git#ci-cd#registry#devops
Category
DevOps & CI/CDAd Space
Shortcuts: C CopyF FavoriteD Download