Questions tagged [docker-in-docker]

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 , have native DinD support. Consider tagging your question with both and a CI-specific tag if your question is about setting up a DinD-based CI system.

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

276 questions
0
votes
1 answer

How do I pull from a Docker registry only when required, or what does the word "latest" even mean?

I'm using Gitlab-CI to build some Docker images in a docker-in-docker image. This is significant only because every build uses a new docker-in-docker environment with an empty Docker cache. It is possible to cache the cache in Gitlab and restore it…
Jason Young
  • 439
  • 1
  • 8
  • 18
-1
votes
1 answer

How to tell running my app container in DinD instead of host Docker

I would like to run my docker containers in a sandbox docker environment. So, I use Docker-in-Docker DinD. I use docker-compose.yaml to define the sandbox: version: '3.8' services: docker: hostname: docker container_name: dind image:…
user842225
  • 5,445
  • 15
  • 69
  • 119
-1
votes
1 answer

Building a Docker Image and pushing to AWS using Auto DevOps in GitLab

I'm a fairly experienced Dev. I have extensive knowledge of Docker, Jenkins, Git, Kubernetes.. I have an existing jenkins job that checks out some stuff from our Git repo, builds a docker image, and pushes it to an AWS ECR. This obviously requires…
-1
votes
2 answers

docker compose inside docker in docker

What I have: I am creating a Jenkins(BlueOcean Pipeline) for CI/CD. I am using the docker in docker approach to use Jenkins as described in the Jenkins docs tutorail. I have tested the setup, it is working fine. I can build and run docker images in…
Hanzla
  • 214
  • 5
  • 15
-1
votes
1 answer

Cannot run docker:dind as docker:docker

I cannot run docker:dind as docker:docker even I intuitively should: [sad@localhost ~]$ docker pull docker Using default tag: latest latest: Pulling from library/docker 540db60ca938: Already exists 5a38b3726f4b: Already exists e5fa5deb3340:…
-2
votes
0 answers

Do I have to use Gitlab container registry when using DinD?

Currently, I'm using DinD but I don't have enable Gitlab container registry in my Gitlab repo to use it in gitlab-ci. Whenever I'm building a Docker image, it's building the same image from scratch. Therefore, if you don't push a recently build…
1 2 3
18
19