Docker 05: How to install Jenkins using Docker?

Docker 05: How to install Jenkins using Docker?

Table of contents

No heading

No headings in the article.

In this blog post let us learn about installing and running Jenkins in a docker container.

Step 1: Go to this link Docker Hub and find the command to pull the Jenkins image to our local machine.

pull.png

Step 1: Run the below command in the terminal to pull the Jenkins image locally.

sudo docker pull jenkins/jenkins:lts-jdk11

After executing the above command successfully, we should see something like the one below.

pull_2.png

Step 2: Now run the below command to start the Jenkins container.

sudo docker run -p 8090:8080 -p 50000:50000 --restart=on-failure -v /home/brahma/Jenkins/jenkins_docker_container:/var/jenkins_home jenkins/jenkins:lts-jdk11

"8090:8080" - exposing the port "8090" on the local host to "8080" on the docker container for Jenkins.

"50000:50000" - exposing the "50000" port on the local to the "50000" port on the docker container for Jenkins agents.

And "-v" indicates the volume mapping between the container and the local host.

Step 3: After the successful execution of the above command, we should see something like this below.

run_command.png

Now navigate to http://localhost:8090 in a browser, then we should see something like the below.

jenkisn_init.png

Step 4: Copy the initial password from the location /var/jenkins_home/secrets/initialAdminPassword and paste it to the admin password field as shown in the above screenshot.

Now click on the Continue button.

Step 5: Select suggested plugins and wait for all the plugins to install, it takes a couple of minutes.

instll_plugins.png

plugins.png

Step 6: You can create a user and Save and continue or Skip and continue as admin as shown below.

admin.png

Click Save and finish

config.png

Step 7: In the final step, start using Jenkins with localhost:8090 in a browser.

jenkins_home.png

This is how we can install/run Jenkins as a docker container. Hope this blog post added value to your learning. Thank you for reading, please comment with your queries or suggestions on this blog. Keep learning. #docker #dockerwithbrahma

Did you find this article valuable?

Support QA Automation Enthusiast by becoming a sponsor. Any amount is appreciated!