Running Jenkins inside Docker Container, along with container within a container

Running Jenkins inside Docker Container, along with container within a container

Welcome to our technical blog on Jenkins and Dockers. Let me brief you about Jenkins and Docker.

Jenkins + Docker

Jenkins is a popular open-source automation tool that helps automate software building, testing, and deployment. Docker, on the other hand, is a platform that allows you to easily create, deploy, and run applications in containers.

In this blog, we will be discussing how to use these two powerful tools together. Whether you are new to these tools or a seasoned veteran, we hope that you will find this blog informative and helpful in your journey.

Let’s look at the procedures we should follow to run a docker container inside the Jenkins Container;

Step 1: Install docker on your PC. Run the following command to see if Docker is installed:

Check Docker Installation

Step 2: Create Dockerfile by typing vim Dockerfile and pasting the following code:

Step 3: By clicking Esc and typing:wq, you can save the file (write and quit).
Check to see if the file has been saved:

File Saved or Not

Step 4: We must now execute that Dockerfile. To create a Docker image, enter the following instructions into your terminal:

docker image build -t Jenkins-img

Step 5: To execute the Docker image and construct the Jenkins container, use the following commands:

docker container run -d -p 8088:8088 -p 50000:50000 -v /var/run/docker.sock:/var/run/docker.sock –name Jenkins-c jenkins-img

Step 6: To see if the container is running, use the command docker ps. Enter docker logs custom-Jenkins-docker to obtain an auto-generated password.

Obtain Auto-Generated Password

Step 7: To access Jenkins, enter localhost:8080 or the IP address of your system (in the case of a remote machine).

Unlock Jenkins

Congratulations if you get the screen shown above. Jenkins has been successfully installed. You will be able to enter Jenkins after pasting the auto-generated password into the administrator password.

I hope this blog was informative and provided you with the details you required. If you have any questions while reading the blog, message me on Instagram or LinkedIn. Special credits to my team member — Gaurav and Krisha Amlani.For any kind of work related to DevOps, Site Reliability you can contact me at helpmeanubhav@gmail.com

Thank You…