Docker-in-Docker (DinD) is an unusual approach to run Docker containers by running a nested Docker daemon inside another container.
"Docker-in-Docker" (DinD) is an unusual approach to running Docker containers: instead of using docker run
normally, an operator can run the Docker Hub docker image
to run a second Docker daemon inside a container, and then launch containers inside that nested Docker daemon.
For most practical purposes, if a container needs to launch another container, it can use the host's Docker socket
docker run -v /var/run/docker.sock:/var/run/docker.sock ...
This approach is sometimes referred to as "Docker-out-of-Docker", in contrast to the nested Docker-in-Docker setup.
Jérôme Petazzoni's blog post Using Docker-in-Docker for your CI or testing environment? Think twice. describes some of the advantages and challenges of a DinD setup. That post notes:
The primary purpose of Docker-in-Docker was to help with the development of Docker itself. Many people use it to run CI (e.g. with Jenkins), which seems fine at first, but they run into many “interesting” problems that can be avoided by bind-mounting the Docker socket into your Jenkins container instead.
Some CI systems, notably gitlab-ci, have native DinD support. Consider tagging your question with both docker-in-docker and a CI-specific tag if your question is about setting up a DinD-based CI system.
The docker-in-docker tag should be used on questions about a DinD setup. It does not describe questions about sharing the host's Docker socket. In most cases these questions will also be tagged with docker. Remember that Stack Overflow questions must be programming related: questions about setting up CI systems or copying images between Docker daemons are likely not on-topic.