How to Install Jenkins on Docker [2025 Beginner’s Guide]

Introduction

HowtoInstallJenkinsonDocker
HowtoInstallJenkinsonDocker

In this guide, we’ll walk you through how to install Jenkins on Docker running on Ubuntu. Jenkins is a popular open-source automation server used by developers and DevOps engineers to build, test, and deploy applications. Running Jenkins inside a Docker container is a fast and flexible way to get started ,perfect for both testing environments and lightweight CI/CD pipelines.

Whether you’re a beginner or just need a quick setup, this step-by-step tutorial will help you get Jenkins up and running in minutes.

Prerequisites

Before installing Jenkins on Docker, make sure you have the following ready:

  • Ubuntu Server (20.04 or later) – This guide assumes you’re running Ubuntu.
  • Docker Installed – Install Docker on Ubuntu if not already set up.

Pull the Jenkins Docker Image

In this guide we are using AWS EC2 ubuntu server.Before running jenkins, we need to pull the latest jenkins LTS image.

docker pull jenkins/jenkins:lts

This pulls the latest Long-Term Support (LTS) version of Jenkins.

If docker is not installed , we can install using this link:How to install docker in ubuntu

Run Jenkins Container

With below command we can run jenkins on docker.

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

Explaination:

-p 8080:8080: Jenkins UI port ( Make sure 8080 port is open in security group if you are running on AWS EC2)
-p 50000:50000: For Jenkins agents
-v jenkins_home:/var/jenkins_home: Persists Jenkins data

We can verify if jenkins container is up and running by below command

docker ps

Access Jenkins and Unlock

Visit Jenkins UI

As we can check jenkins container is running on docker , we can access it with AWS EC2 public ip and port. In case you are running on local , it can be accessed using localhost and port.

< public ip >:8080  #In case of AWS EC2 
localhost:8080      #In case of running localy

Get the initial admin password

docker exec jenkins cat /var/jenkins_home/secrets/initialAdminPassword

We can copy the initial admin password and access jenkins.

Install Suggested Plugins

  • After unlocking, choose “Install Suggested Plugins”

After clicking on Installed suggested plugins , it will take time to install plugins and get ready.

Once all the plugins are installed , we need to create admin user and password.

Jenkins is Ready!

One we have done all the installation and setup, we can start creating pipelines for our projects.

Conclusion

Running Jenkins on Docker is a quick and efficient way to get your CI/CD pipeline started. It’s portable, lightweight, and ideal for development or testing environments. You can further customize Jenkins with volumes, plugins, and integrations.

Leave a Reply

Your email address will not be published. Required fields are marked *