This repository contains a Docker Compose setup for running a complete CI/CD stack with the following services:
- Traefik (v2.10) - Reverse Proxy with SSL termination
- Jenkins (2.489-jdk17) - Continuous Integration Server
- SonarQube (LTS) - Code Quality Analysis
- Docker-in-Docker - For running Docker commands inside Jenkins
- Docker Engine 20.10+
- Docker Compose v2+
- OpenSSL (for generating certificates)
- Generate self-signed certificates:
# Create certs directory if it doesn't exist
mkdir -p certs
# Generate self-signed certificate
openssl req -x509 -nodes -days 365 -newkey rsa:2048 \
-keyout certs/server.key \
-out certs/server.crt \
-subj "/CN=localhost/O=My Company/C=US"- Start the services:
docker-compose up -d- Jenkins: https://localhost/jenkins
- SonarQube: https://localhost/sonarqube
- Traefik Dashboard: https://localhost/dashboard/
- Uses custom SSL certificates
- Configuration in
traefik.ymland dynamic configuration incerts/tls.yml - Handles routing and SSL termination for all services
- Runs with Docker-in-Docker support
- Accessible under the
/jenkinscontext path - Resource limits: 4GB RAM, 2 CPUs
- Runs in LTS version
- Accessible under the
/sonarqubecontext path - Resource limits: 2GB RAM, 1 CPU
- Uses named volumes for data persistence
The stack uses several named volumes for data persistence:
jenkins_home: Jenkins configuration and datasonarqube_data: SonarQube datasonarqube_extensions: SonarQube pluginssonarqube_logs: SonarQube logs
- Custom SSL certificates are used for HTTPS
- Traefik dashboard is secured
- All services are isolated in their own network
- Sensitive files (certificates) are git-ignored
To backup the data, you can use Docker's volume backup feature:
docker run --rm -v jenkins_home:/source:ro -v $(pwd):/backup alpine tar czf /backup/jenkins_backup.tar.gz -C /source ./To update services to their latest versions:
docker-compose pull
docker-compose up -dIf you encounter certificate warnings in your browser:
- For development: Add the self-signed certificate to your system's trust store
- For production: Replace the certificates with valid ones from a trusted CA
If you encounter permission issues with SonarQube:
- Ensure the volumes have correct permissions
- The service runs with user ID 1000:1000
- Add the service configuration to
docker-compose.yml - Configure Traefik labels for routing
- Update the README with new service details
For local development, you can use the .env file to override configurations:
cp .env.example .env
# Edit .env with your settings