Self-hosted GitLab Enterprise Edition (EE) using Docker Compose. Works on AWS EC2, DigitalOcean, and other cloud providers. Optimized for 4GB RAM instances.
- GitLab Enterprise Edition Nightly - Latest features and bleeding edge updates
- Docker-based deployment - Simple setup
- Memory optimized - Runs well on 4GB RAM
- Environment-based configuration - Easy IP and password management
- Token creation script - Bypass web UI bugs
- Cloud deployment - Works on AWS EC2, DigitalOcean, etc.
- Custom ports - Uses port 8929/2222 to avoid conflicts
- Docker 20.10+
- Docker Compose 1.29+ (or
docker-composestandalone) - 4GB RAM (2GB works but slow as hell)
- 20GB disk space minimum
- Ubuntu 22.04 or similar Linux distribution
git clone https://github.com/zinx110/gitlab-cloud-docker.git
cd gitlab-cloud-dockerEdit the .env file:
nano .envSet your values:
# Initial root password for first-time setup
INITIAL_PASSWORD=YourSecurePassword123!
# Your server's public IP address (leave empty for localhost)
EXTERNAL_IP=54.123.45.67docker-compose up -dWait 3-5 minutes for GitLab to initialize, then access:
- URL:
http://YOUR-IP:8929 - Username:
root - Password: (from your
.envfile)
.
βββ docker-compose.yml # Main Docker Compose configuration
βββ .env # Environment variables (passwords, IPs)
βββ create-token.sh # Helper script for creating API tokens
βββ README.md # This file
βββ config/ # GitLab configuration (auto-generated)
βββ logs/ # GitLab logs (auto-generated)
βββ data/ # GitLab data (auto-generated)
- 8929 - GitLab Web UI (HTTP)
- 2222 - GitLab SSH (Git operations)
The configuration is optimized for 4GB RAM:
- 4 Puma workers
- 20 Sidekiq concurrency
- Prometheus monitoring enabled
- 512MB PostgreSQL buffers
Key settings in docker-compose.yml:
puma['worker_processes'] = 4
sidekiq['max_concurrency'] = 20
postgresql['shared_buffers'] = "512MB"
prometheus_monitoring['enable'] = truedocker-compose up -ddocker-compose downdocker logs -f gitlabdocker psdocker restart gitlabIf the web UI has issues creating tokens:
./create-token.sh "my-token-name" 365Arguments:
my-token-name- Token name (optional)365- Days until expiry (optional, default: 365)
-
Launch Instance:
- Type: t3a.medium (4GB RAM, 2 vCPU)
- Use Spot instance for 70% discount (~$4 for 2 weeks)
- OS: Ubuntu 22.04 LTS
- Storage: 20GB minimum
- Security Groups: 22, 8929, 2222
-
Get Elastic IP (Optional but Recommended):
- AWS Console β EC2 β Elastic IPs β Allocate
- Associate with your instance
- This gives you a permanent IP that doesn't change on restart
-
Install Docker:
sudo apt update sudo apt install -y docker.io docker-compose sudo systemctl start docker sudo usermod -aG docker ubuntu exit # Log out and back in
-
Upload files and configure
.envwith your Elastic IP -
Start GitLab:
docker-compose up -d # Wait 3-5 minutes for startup docker logs -f gitlab
Same steps as AWS - just adjust security group/firewall rules for your provider.
β οΈ Change default password after first login- π Add HTTPS if you care (need SSL certificate)
- π‘οΈ Restrict SSH access to your IP only in security group
- π Never commit
.envto git - πΎ Backup
data/directory if you have important stuff
# Check logs
docker logs gitlab
# Check available memory
free -h
# Ensure swap is enabled
swapon --showThis means nginx is working but Puma (Rails backend) isn't responding.
# Check if all services are running
docker exec gitlab gitlab-ctl status
# Reconfigure GitLab with correct external_url
docker exec gitlab gitlab-ctl reconfigure
# Restart Puma
docker exec gitlab gitlab-ctl restart puma
# If still broken, nuclear option:
docker-compose down -v
sudo rm -rf config/ logs/ data/
docker-compose up -d- Check AWS Security Group has port 8929 open to 0.0.0.0/0
- Verify
EXTERNAL_IPin.envmatches your server's public IP - Make sure you're using http:// not https://
- Test:
curl -I http://YOUR-IP:8929from the server
Solution: Use a bigger instance. 2GB is too small.
# Check memory usage
free -h
docker stats gitlab --no-stream
# If using 2GB, upgrade to 4GB instance (t3a.medium)Use the provided script:
./create-token.sh "my-token"This is a known issue in nightly builds and bypasses the web UI.
# Fix Docker permissions
sudo usermod -aG docker $USER
exit
# Log back in| Use Case | RAM | CPU | Storage | AWS Instance |
|---|---|---|---|---|
| Testing (2-4 users) | 4GB | 2 vCPU | 20GB | t3a.medium |
| Small team (5-10) | 8GB | 2 vCPU | 50GB | t3a.large |
| Medium team (10-50) | 16GB | 4 vCPU | 100GB | t3a.xlarge |
Note: 2GB technically works but is slow as hell. Just use 4GB.
# Pull latest image
docker-compose pull
# Restart with new image
docker-compose up -dNote: Always backup before upgrading!
# Stop GitLab
docker-compose down
# Backup data directory
tar -czf gitlab-backup-$(date +%Y%m%d).tar.gz data/ config/
# Restart GitLab
docker-compose up -d# Stop GitLab
docker-compose down
# Extract backup
tar -xzf gitlab-backup-YYYYMMDD.tar.gz
# Restart GitLab
docker-compose up -d# Enter GitLab container
docker exec -it gitlab bash
# Run GitLab Rails console
docker exec -it gitlab gitlab-rails console
# Check GitLab version
docker exec gitlab cat /opt/gitlab/version-manifest.txt
# Reconfigure GitLab
docker exec gitlab gitlab-ctl reconfigure
# Check all GitLab services
docker exec gitlab gitlab-ctl status- GitLab Documentation
- GitLab Docker Installation
- GitLab API Documentation
- Docker Compose Documentation
Contributions are welcome! Please feel free to submit a Pull Request.
This project is open source and available under the MIT License.
- This uses GitLab EE nightly builds - expect bugs and breaking changes
- All EE features work without a license (you'll just see an "unlicensed" banner)
- Good for testing, learning, small teams, and personal projects
- Issues: Open an issue in this repository
- GitLab Forum: https://forum.gitlab.com/
- Stack Overflow: Tag questions with
gitlab
- GitLab: EE Nightly (18.5.0+)
- Docker Compose: 1.29+
- Tested on: Ubuntu 22.04, Amazon Linux 2023
GitLab Cloud Docker - Simple self-hosted GitLab setup for cloud deployments