Jenkins CI Server
Jenkins CI/CD server with Docker support.
Overview
Jenkins is an open-source automation server that has become the backbone of continuous integration and continuous deployment (CI/CD) pipelines since its creation in 2011. Originally developed as Hudson by Kohsuke Kawaguchi at Sun Microsystems, Jenkins revolutionized software development by automating the build, test, and deployment processes. With over 1,800 plugins available, Jenkins can integrate with virtually any tool in the development ecosystem, making it the Swiss Army knife of DevOps automation. This Docker configuration provides a production-ready Jenkins instance with Docker-in-Docker capabilities, enabling containerized build processes and modern CI/CD workflows. The setup includes proper volume mounting for persistence, network isolation for security, and Docker socket access for container management within Jenkins pipelines. By running Jenkins in Docker with Docker support, teams can create sophisticated build pipelines that leverage containerization while maintaining consistency across different environments. This stack is ideal for development teams transitioning to containerized workflows, DevOps engineers managing complex multi-service applications, and organizations requiring robust automation with the flexibility to integrate custom tools and processes through Jenkins' extensive plugin ecosystem.
Key Features
- Pipeline as Code support through Jenkinsfile for version-controlled build definitions
- Access to 1,800+ plugins for integration with virtually any development tool
- Docker-in-Docker capabilities for containerized builds and deployments
- Blue Ocean modern UI for visual pipeline creation and monitoring
- Distributed build support with Jenkins agents for horizontal scaling
- Built-in credentials management system for secure API keys and certificates
- Matrix builds for testing across multiple configurations simultaneously
- Shared pipeline libraries for reusable code across multiple projects
Common Use Cases
- 1Automated testing and deployment of microservices with Docker container builds
- 2Legacy application modernization with gradual CI/CD pipeline implementation
- 3Multi-platform software builds targeting different operating systems and architectures
- 4Integration testing environments that spin up temporary Docker containers
- 5Automated security scanning and compliance checks in regulated industries
- 6Custom automation workflows for infrastructure provisioning and management
- 7Code quality gates with automated static analysis and test coverage reporting
Prerequisites
- Minimum 2GB RAM allocated to Docker (Jenkins requires 512MB minimum, 2GB+ recommended)
- Docker Engine with privileged container support enabled
- Port 8080 and 50000 available on the host system
- Basic understanding of Jenkins pipeline concepts and Groovy scripting
- Familiarity with Docker commands for troubleshooting container issues
- Administrative access to retrieve initial Jenkins admin password from container logs
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 jenkins: 3 image: jenkins/jenkins:lts4 container_name: jenkins5 restart: unless-stopped6 privileged: true7 user: root8 ports: 9 - "${JENKINS_PORT:-8080}:8080"10 - "50000:50000"11 environment: 12 - DOCKER_HOST=tcp://docker:237613 - DOCKER_CERT_PATH=/certs/client14 - DOCKER_TLS_VERIFY=115 volumes: 16 - jenkins_home:/var/jenkins_home17 - /var/run/docker.sock:/var/run/docker.sock18 networks: 19 - jenkins-network2021volumes: 22 jenkins_home: 2324networks: 25 jenkins-network: 26 driver: bridge.env Template
.env
1# Jenkins2JENKINS_PORT=8080Usage Notes
- 1Jenkins at http://localhost:8080
- 2Get initial password from logs
- 3Install suggested plugins
- 4Docker socket mounted for DIND
Quick Start
terminal
1# 1. Create the compose file2cat > docker-compose.yml << 'EOF'3services:4 jenkins:5 image: jenkins/jenkins:lts6 container_name: jenkins7 restart: unless-stopped8 privileged: true9 user: root10 ports:11 - "${JENKINS_PORT:-8080}:8080"12 - "50000:50000"13 environment:14 - DOCKER_HOST=tcp://docker:237615 - DOCKER_CERT_PATH=/certs/client16 - DOCKER_TLS_VERIFY=117 volumes:18 - jenkins_home:/var/jenkins_home19 - /var/run/docker.sock:/var/run/docker.sock20 networks:21 - jenkins-network2223volumes:24 jenkins_home:2526networks:27 jenkins-network:28 driver: bridge29EOF3031# 2. Create the .env file32cat > .env << 'EOF'33# Jenkins34JENKINS_PORT=808035EOF3637# 3. Start the services38docker compose up -d3940# 4. View logs41docker 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/jenkins-ci/run | bashTroubleshooting
- Jenkins shows 'Offline' status: Check if port 8080 is accessible and not blocked by firewall rules
- Docker builds failing with permission denied: Verify Docker socket mount and that Jenkins runs with root privileges
- Initial setup wizard not loading: Retrieve admin password using 'docker logs jenkins' and check container startup completion
- Plugins failing to install: Increase Jenkins memory allocation and verify internet connectivity from container
- Build agents not connecting on port 50000: Ensure port 50000 is exposed and accessible through network security groups
- Out of disk space errors: Monitor jenkins_home volume usage and implement log rotation policies
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
Ad Space
Shortcuts: C CopyF FavoriteD Download