Running Jenkins on Docker Container

Time is very precious. Back in the year 2016, I have published an article on installing Tomcat and Jenkins. During those days, I was not familiar with Docker containers. However, with Docker, everything is now quickly deployed, destroyed and re-recreated very easily. We have more flexibility. So, in this article which is very quick and pretty straight forward, I am going to deploy Jenkins on a docker container. For those who are not familiar to Docker please see the article 30 commands to start with Docker container.

1. Deploy your VM on production or on a Lab. You can also run directly on a physical machine depending on how you want your Docker environment to be set up. Pull Jenkins image from Docker hub and run it.

docker pull Jenkins && docker run -p 8080:8080 50000:50000 jenkins

2.  You should notice that a temporary password has been created:

3. Go to the IP address:<8080> of your physical /virtual host where the docker has been installed, and the Jenkins should be accessible from there. Simply enter the password there.By this time, you should see the “Getting Started” page.

4.  Currently, I have selected “Select Plugins to install” and hit the “Install” button.

5.  Setup an admin account and start you should get the Jenkins GUI ready.

6. On the dashboard, go to “New Item” and then click on “Free Style Project” and press “OK”.

7. Scroll down, go to “Build”, and in the “Execute shell command” box you can just put a shell command there.

Then click on “Apply and Save”

8. Now, if you go back to your dashboard, you should see the Item there.

Pretty basic and simple stuff. Enjoy 🙂