Installing Jenkins using Docker

A step by step guide on how to install Jenkins using Docker.

17 December, 2021

2

2

0

Jenkins is one of the most popular automation servers that provides support for building and deploying pipelines and make the development process fully automatic.
In this article, we will see how to use Docker to install and run Jenkins in a container. To understand what Docker is, visit my Docker vs Kubernetes article.
Installing Jenkins using Docker
img
For installing and running Docker, we are going to use Katacode. It is an interactive learning and training platform for software engineers. It provides real environments for learning new technologies right in the browser.
Before we begn with the installation process, let us check if docker is installed in the Katacode environment by running the docker version command. In case the docker is not installed, we run the apt install docker command.
docker version
img
After checking the docker version, we run the Jenkins image in detached mode -d and bind it to port 8080. Along with this, we also open a port at 50000 that is used by the master and the worker nodes Jenkins to communicate with each other. Then we specify a docker named volume -v my-jenkins-home:/var/jenkins_home. This named volume helps in persisting the Jenkins state in the environment file system.
Let’s check if the container is up and running by typing the docker ps command.
docker ps
img
We can see that our container is up and running.
Now we head over to port 8080 by clicking the plus symbol on the right side of the terminal and selecting the “Select port to view on the Host 1” option.
selecting the port 8080 option
img
This opens a new browser tab where we specify the port that we want to display. In our case, we type 8080 and click the Display button.
img
On clicking the display button, we get redirected to the Jenkins login page where we are needed to enter the admin password.
Jenkins login page
img
To obtain the password, we have to be inside the Jenkins’ container. For that, we have to run the exec command in interactive mode.
Then we read the data from the file in the secrets folder using the cat command.
img
We enter the obtained password in the Administrator password section and press continue.
Unlocking Jenkins by entering the password
img
This takes us to the next section where we are asked to customize Jenkins by installing the plugins. In our case, we install the suggested plugins by selecting the Install suggested plugins option.
Customizing Jenkins
img
On selecting this option, Jenkins start installing all the recommended plugins.
plugin installation
img
Once the installation of the plugins is complete, we are asked to create a user by entering a username and password. After entering the credentials, we press save and continue.
Create user page
img
img
Then we press Start using Jenkins.
Start using Jenkins page
img
This brings us to the Welcome page of Jenkins, where we manage and build the pipelines, add plugins, etc for different jobs as per user needs.
Jenkins Welcome Page
img
This is how we install and run Jenkins in Docker.
For more such 💻DevOps content, follow 🚀 Dipankar Medhi.

docker

devops

developer

cicd

jenkins

2

2

0

docker

devops

developer

cicd

jenkins

Dipankar Medhi
Engineer (Data & ML)

More Articles

Showwcase is a professional tech network with over 0 users from over 150 countries. We assist tech professionals in showcasing their unique skills through dedicated profiles and connect them with top global companies for career opportunities.

© Copyright 2025. Showcase Creators Inc. All rights reserved.