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
4
votes
0 answers

How to create a Docker in Docker Service on Docker Swarm (Swan Mode)

I would like to run (Docker-in-Docker) DIND inside a SWARM cluster(Swarm Mode). As Swarm does not support the --privileged flag its not possible to start a DIND Container like you see in the tutorials. However --privileged can be "emulated" What…
Vad1mo
  • 5,156
  • 6
  • 36
  • 65
4
votes
2 answers

GitLab CI - Cannot Log In To Docker Registry (x509)

I'm trying to get my GitLab CI/CD set up using the Docker executor and the docker-in-docker approach and am stuck on the the following issue: In my .gitlab-ci.yml I am attempting to establish a connection with GitLab's integrated docker registry for…
ediv
  • 71
  • 1
  • 4
4
votes
1 answer

How to run docker container inside docker (DIND)?

I am trying to run a container inside another container using Docker inside docker https://hub.docker.com/_/docker. When I run the following: docker run --privileged docker:stable-dind docker run hello-world I get the following error…
Jamesla
  • 1,378
  • 7
  • 31
  • 62
3
votes
3 answers

Getting `GLIBC_2.32' and `GLIBC_2.34' not found in Jenkins (Docker) with DinD on Ubuntu 22.04

I am trying to configure Jenkins as docker container with docker-in-docker on an EC2 instance running Ubuntu 22.04 but I am getting `GLIBC_2.32' and 'GLIBC_2.34' not found when I try to run a script containing docker command using docker plugin in…
3
votes
0 answers

How to configure Kubernetes "docker on docker" using containerd on Azure

We need to migrate a configuration from Google Cloud Platform to Azure. In GCP, we have Jenkins running in Kubernetes. The Kubernetes worker nodes run on Container-Optimized OS with containerd. This allows us to use the Docker daemon running on the…
Emil Salageanu
  • 997
  • 1
  • 10
  • 24
3
votes
1 answer

Testcontainers works locally but fails on build server (DinD)

Our recent move to a jenkins in a docker-image has not been so smooth. We have a (over?)complicated setup where one docker container starts a new one and, previously, shared data with the new container by sharing host-folders. In essence we have…
3
votes
2 answers

jenkins run docker command get permission denied

i'm new to jenkins. currently i have a jenkins server start by docker with this docker-compose file: version: '3.7' services: jenkins: image: jenkins/jenkins:lts privileged: true user: root ports: - 50000:50000 …
3
votes
4 answers

Is it possible to install the Sysbox container runtime on GKE?

I'd like to install a CI tool on GKE so I can run docker-in-docker via Sysbox. In order to do that, I need to install the Sysbox container runtime. Is it possible to do that in GKE?
Jeff Dean
  • 53
  • 6
3
votes
0 answers

gitlab-ci: Cannot connect to the Docker daemon at tcp://docker:2375. Is the docker daemon running?

I'm installing a personal runner for my projects. sudo docker run --rm -v /srv/gitlab-runner/config:/etc/gitlab-runner gitlab/gitlab-runner register \ --non-interactive \ --executor "docker" \ --docker-image docker:stable \ --url…
3
votes
1 answer

Using BuildKit with a mounted `/var/run/docker.sock` in GitLab CI

I have a registered gitlab-runner with a docker executor. When it runs this .gitlab-ci.yml: image: docker:latest variables: DOCKER_BUILDKIT: "1" build: stage: build script: # There are additional flags cut out requiring BuildKit. -…
Mario Ishac
  • 5,060
  • 3
  • 21
  • 52
3
votes
1 answer

With Google Cloud Build, how do I run a Makefile that executes docker and kubectl commands?

I received a project that is built with a number of Makefiles which run a number of docker commands. I want to build it on Cloud Build. I know that Cloud Build handles Docker natively, but must work with the existing Makefile-structure. I tried the…
Joshua Fox
  • 18,704
  • 23
  • 87
  • 147
3
votes
0 answers

Share a volume between containers with DinD

I have a GitLab CI job that is currently using DinD. The CI runs inside a docker container. What I am trying to accomplish is: The CI job docker container, using dind, runs a docker container with a volume. docker run --name cvmfs --pid=host…
djuarezg
  • 2,307
  • 2
  • 20
  • 34
3
votes
0 answers

Docker in docker on Windows 10

I have a Ubuntu18.04 server and want to run docker in it to launch containers. Because I have Windows locally, I planned to use Docker to launch the Ubuntu18.04 server itself. But there seems to be some problem with runlevels on…
Maximilian Mordig
  • 1,333
  • 1
  • 12
  • 16
3
votes
2 answers

Docker dind : Cannot connect to the Docker daemon

While running docker:dind I can't use docker login command and any other docker command. My use case is that I got a Nexus Docker Registry and I'm trying to connect to this registry through GitLab CI. docker run --rm -it docker:stable-dind docker…
ricko zoe
  • 496
  • 1
  • 6
  • 19
3
votes
2 answers

Mouting relative folders in docker-compose when using docker daemon via a container?

We have previously been running Jenkins in Docker in Docker (DIND) mode, i.e. running a docker daemon inside the Jenkins docker container. But due to many problems (some of which are described in the link above) we've decided to move away from this…
Johan
  • 37,479
  • 32
  • 149
  • 237