How to install Jenkins inside Docker container

Ayush Srivastava
3 min readMay 18, 2024

--

As we all know Jenkins is an open-source software for build, test and deploy whereas Docker is a platform for running applications in an isolated environment called as ‘containers.

Well Jenkins can be downloaded either locally or by installing on any server. If you want to install Jenkins, you can download from here.

But for this post we will use Jenkins docker image. Let’s start:

Step 1: We will use Docker Desktop for our local system, so first install Docker Desktop from here. Make sure you have to add “C:\Program Files\Docker\Docker\resources\bin” this path in PATH section in your environment variables.

Step 2: Now launch the docker desktop and open either command prompt/Windows PowerShell to run this command:

docker pull jenkins
or
docker run --name myjenkins -p 8080:8080 -p 50000:50000 -v /var/jenkins_home jenkins/jenkins:lts-jdk17

Here -p 8080:8080 maps port 8080 on the host to port 8080 in the container (for the Jenkins web interface).

-p 50000:50000 maps port 50000 on the host to port 50000 in the container (for Jenkins agent communication with Jenkins master).

The above command will pull the Jenkins image from Docker Hub.

Now when you do “docker ps” command, you will get this output.

Jenkins Docker image

Step 3: After installation, there is an initial password will be there. Make sure you copied as it will require further.

Step 4: Now Jenkins run on “http://localhost:8080/” open this on any web browser.

Now under the “Administrator Password” enter the copied password.

Getting started

Step 5: Click on “Installed suggested plugins”.

Install suggested Plugins

Step 6: Now it will install the required Plugins.

Installing Plugins

Step 7: After plugins installation, it will ask you to enter your new admin username and password.

Create Admin user and Password

Step 8: By default, Jenkins runs on “http://localhost:8080/” so recommendation is not changing the by default URL.

Instance Configuration

Step 9: Now setup is complete, and Jenkins is ready!

Jenkins Ready

Conclusion:

Installing Jenkins using docker is an efficient way to use as it saves memory and easy to install. It is easier to manage and deployment your processes.

Happy Automating!

--

--

Ayush Srivastava
Ayush Srivastava

Written by Ayush Srivastava

Engineer by Profession, Friendly by Nature

No responses yet