How I Set Up Jenkins Locally Using Docker (And You Can Too!)

If you’re anything like me, sometimes you just need a safe sandbox to tinker with Jenkins — whether it’s to troubleshoot something, play with pipelines, or test out new plugins. I didn’t want to clutter my machine or fight with manual installations… so Docker to the rescue!

In this post, I’ll show you exactly how I set up Jenkins on my laptop in less than 5 minutes. No guesswork, no mess — just a clean setup that you can spin up or tear down whenever you like.


🛠 What I Prepared Before Starting

Before running anything, I made sure of a few things:

  • My laptop has at least 4GB RAM (8GB is smoother).
  • Around 10GB free disk space (Jenkins loves space).
  • Docker installed and running. Quick check in the terminal:
docker --version

If you don’t have Docker yet, I recommend following the official instructions for your OS here.


🔥 The Command That Did It All

Here’s the exact command I used to get Jenkins running as a Docker container:

docker run -d --name jenkins-lab -p 8080:8080 -p 50000:50000 -v jenkins_data:/var/jenkins_home jenkins/jenkins:lts

Quick breakdown:

  • -d: Run in the background.
  • --name jenkins-lab: Just gave it a name I can remember.
  • -p 8080:8080 and -p 50000:50000: Mapping ports.
  • -v jenkins_data:/var/jenkins_home: Keeps Jenkins data safe even if I restart the container.

👉 Tip: If Docker throws permission errors, just prepend sudo to the command.


💻 Accessing Jenkins

Once the container was up, I opened my browser and went to:

http://localhost:8080

On the first launch, Jenkins asks for an admin password. To grab that, I ran:

docker logs jenkins-lab

It displayed a password I could copy-paste to unlock the setup wizard.


✏️ Why I Love This Setup

  • No clutter on my machine — it’s all contained in Docker.
  • I can try out risky configurations without stress.
  • Want to start over? Stop and remove the container, done!
  • Perfect playground for testing Jenkins pipelines and plugins.

🧹 Clean-Up (When You’re Done)

If I ever want to remove Jenkins from my laptop, it’s just two commands:

docker stop jenkins-lab  
docker rm jenkins-lab

And poof — all gone, like it was never there.