Docker Inside Docker !!

Prathamesh Mistry
2 min readMar 25, 2021

--

Today’s IT Industry is all about Containerization. No Company wants their Development Team or Testing Team to spend half of their time spinning up new Virtual Machines for creating Isolated Systems. This could awfully decrease the throughput of the Company.

The Industry is using Tools like CRI-O, Podman, Rocket, and Docker. Docker is a software platform for building applications based on containers — small and lightweight execution environments that make shared use of the operating system kernel but otherwise run in isolation from one another. Here’s another fun practical on Docker

In this article, we will be creating a docker container inside another docker container.

Create a Docker Image of Docker

docker pull docker

Create a container using this Image

docker run -it --name c_001 -v /var/run/docker.sock:/var/run/docker.sock docker

We are mounting the docker socket to the container created using the docker image. docker.sock is the UNIX socket that the Docker daemon is listening to. It's the main entry point for Docker API. This file can be used to communicate with the daemon from within a container. Docker-cli client uses this socket to execute docker commands by default.

Container with docker support

Finally, Let’s create a container inside this container

Stopping/Terminating the Parent Container will automatically stop all the containers that were running inside the container.

Thank You!

Sign up to discover human stories that deepen your understanding of the world.

Free

Distraction-free reading. No ads.

Organize your knowledge with lists and highlights.

Tell your story. Find your audience.

Membership

Read member-only stories

Support writers you read most

Earn money for your writing

Listen to audio narrations

Read offline with the Medium app

--

--

Prathamesh Mistry
Prathamesh Mistry

Written by Prathamesh Mistry

Final Year Student, understanding the industrial approach and tools

No responses yet

Write a response