Running Jenkins (with Docker)
July 17, 2025
The quickest way to get a Jenkins server running for the exam.
Run Jenkins in Docker
docker run -d --name jenkins -p 8080:8080 -p 50000:50000 \
-v jenkins_home:/var/jenkins_home \
jenkins/jenkins:lts
- Open http://localhost:8080
- Get the first-run admin password:
docker exec jenkins cat /var/jenkins_home/secrets/initialAdminPassword
- Install suggested plugins โ create the admin user.
Jenkins needs Docker to build images
If Jenkins runs in a container, it can't build images unless it can reach the Docker daemon. Two options:
- Install Jenkins directly on the machine that has Docker (simplest), or
- Mount the host Docker socket into the Jenkins container:
docker run -d --name jenkins -p 8080:8080 \
-v /var/run/docker.sock:/var/run/docker.sock \
-v jenkins_home:/var/jenkins_home \
jenkins/jenkins:lts
Then install the Docker CLI inside the Jenkins container. This is the classic "Docker-in-Jenkins" setup โ good to mention in the viva.
The Jenkins agent must have Docker installed and permission to use it โ add the
jenkinsuser to thedockergroup, or mountdocker.sockas above.
Next: [[jenkins-docker-hub-credentials]] and [[jenkins-pipeline-job]].