# 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:

![](https://cdn.hashnode.com/res/hashnode/image/upload/v1703051462774/6a7c29b0-3b01-4080-a2c7-322af3544be8.png align="left")

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:

![](https://cdn.hashnode.com/res/hashnode/image/upload/v1703051464054/014ccdce-c903-4055-acc7-ad97646609b2.png align="left")

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.

![](https://cdn.hashnode.com/res/hashnode/image/upload/v1703051465376/30548537-2490-4afa-bb72-14e46df8f76d.png align="left")

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).

![](https://cdn.hashnode.com/res/hashnode/image/upload/v1703051466849/ac4cf240-41ed-4251-bdb5-416d5b2c6742.png align="left")

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](https://www.instagram.com/acanubhav94/) or [LinkedIn](https://www.linkedin.com/in/anubhav-chaturvedi-a7465a72/). Special credits to my team member — [Gaurav](https://www.linkedin.com/in/gaurav-kachariya/) and [Krisha Amlani](https://www.linkedin.com/in/krisha-amlani/).For any kind of work related to DevOps, Site Reliability you can contact me at [helpmeanubhav@gmail.com](mailto:helpmeanubhav@gmail.com)

> Thank You…
