DEV Community

Cover image for Docker-in-Docker (DinD)
Luke
Luke

Posted on

Docker-in-Docker (DinD)

What is DinD?

For a simple terms, I will use docker to run another docker in docker 🤪

DinD

DinD Methodology

Why is it?

It can be used in many cases, but I use it to simulate a multi-host environment on a single physical machine.

How to do it?

Open your command line and run it

docker run --privileged -d --name <your-docker-name> docker:dind 
Enter fullscreen mode Exit fullscreen mode

That's it, now I have a "virtual" of virtual machine to deploy and run the image

Warning ❗❗❗: Because it run with --privileged, so it's only use for dev/test environment => Never use in production

Top comments (0)