Chapter 10: Jenkins Introduction
10.3 Run Jenkins in Docker (lab shape)
A common learning path: run the official Jenkins Long-Term Support (LTS) image locally or on a lab VM you control.
docker volume create jenkins_home
docker run -d --name jenkins \
-p 8080:8080 \
-p 50000:50000 \
-v jenkins_home:/var/jenkins_home \
jenkins/jenkins:lts
| Port (logical shop counter) | Role |
|---|---|
Host 8080 → container 8080 |
Jenkins web UI |
50000 |
Agent inbound (when using certain agent setups) |
Steps — first UI login
- Start the container with a named volume for
jenkins_home. docker logs jenkinsuntil you see the initial admin password path hint.docker exec jenkins cat /var/jenkins_home/secrets/initialAdminPassword(or follow current image docs).- Open the UI on the published host counter; unlock with that password.
- Install suggested plugins for a lab (or skip extras you do not need).
- Create an admin user you will remember; store the password in your password manager — not in Git.
What you see: Jenkins dashboard. First load can be slow while plugins install — watch logs if the UI seems stuck.
Disk. Jenkins home grows with builds. Use a volume; clean old builds when labs fill the disk (df -h habit from Linux refresh).
Versions
Plugin and setup wizard screens change over time. Follow the log messages from your LTS image rather than memorising exact click paths from an old blog.