A lightweight, pre-configured Jenkins setup designed for local testing, CI/CD pipeline experimentation, and automated deployments using Docker-outside-of-Docker (DooD).
├── Dockerfile # Custom Jenkins image with pre-installed Docker CLI
└── docker-compose.yml # Local orchestration with Docker socket mapping
This image extends the official Jenkins LTS image (JDK 25) and installs the docker-ce-cli, allowing Jenkins to execute Docker commands on the host machine.
FROM jenkins/jenkins:latest-jdk25
USER root
RUN apt-get update && \
apt-get install -y apt-transport-https ca-certificates curl gnupg lsb-release && \
curl -fsSL https://download.docker.com/linux/debian/gpg | gpg --dearmor -o /usr/share/keyrings/docker-archive-keyring.gpg && \
echo "deb [arch=$(dpkg --print-architecture) signed-by=/usr/share/keyrings/docker-archive-keyring.gpg] https://download.docker.com/linux/debian $(lsb_release -cs) stable" > /etc/apt/sources.list.d/docker.list && \
apt-get update && \
apt-get install -y docker-ce-cli
USER rootMaps port 8082 for the web UI and mounts the host's Docker socket (/var/run/docker.sock) so Jenkins can build and run sibling containers.
services:
jenkins:
build: .
container_name: jenkins
restart: unless-stopped
ports:
- "8082:8080"
volumes:
- jenkins_home:/var/jenkins_home
- /var/run/docker.sock:/var/run/docker.sock
volumes:
jenkins_home:Ensure both Dockerfile and docker-compose.yml are in the same directory.
Run the following command in your terminal to build the custom image and start the container in the background:
docker compose up --build -d- Open your browser and navigate to:
http://localhost:8082 - Retrieve the initial administrator password from the container logs:
docker logs jenkins
- Copy the password from the terminal, paste it into the setup wizard, install the suggested plugins, and create your admin user.
