Table of contents
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.
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.
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.
Now navigate to http://localhost:8090 in a browser, then we should see something like the below.
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.
Step 6: You can create a user and Save and continue or Skip and continue as admin as shown below.
Click Save and finish
Step 7: In the final step, start using Jenkins with localhost:8090 in a browser.
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