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

How to access an HTTP proxy from containers created by docker in docker

I'm trying to access an HTTP proxy from a container that was created using docker in docker. I'm doing this on a Kubernetes worker that still has docker available. This is what my deployment looks like, apiVersion: apps/v1 kind:…
wsams
  • 2,499
  • 7
  • 40
  • 51
0
votes
1 answer

Hyperledger Fabric 1.4 stopped working after migrating to Kubernetes 1.19, no working /var/run/docker.sock anymore

I have a problem on a running Hyperledger Fabric network 1.4 that was working OK on Azure Kubernetes 1.17 after migrating to 1.19. The chaincode is no longer working and peer nodes shows error "cannot connect to Docker endpoint". Looks like the…
icordoba
  • 1,834
  • 2
  • 33
  • 60
0
votes
0 answers

How to run a single command (task) container with docker:dind image

I'm trying to have a docker:dind container that runs a single command, and then exits. All the examples are based on a daemonized container, and I'm trying to avoid that, I want the container to exit once the entrypoint process finishes. Out of the…
Pawel Veselov
  • 3,996
  • 7
  • 44
  • 62
0
votes
0 answers

GitLab building in DinD fails with 'Please provide a source image with `from` prior to commit'

I have a Dockerfile with ARG before first FROM. It builds correctly on my server (Docker version 20.10.7) however when I try to build it as part of GitLab CICD (GitLab version 13.7.4) within a DinD container (image docker:20.10.7) the build fails…
Barak Adorian
  • 193
  • 1
  • 9
0
votes
1 answer

Gitlab Auto Deploy failing to connect to Docker

I've got Gitlab installed on Kubernetes using Helm and try to get Auto DevOps working but I'm getting the following issue from the Auto DevOps pipeline: Executing "step_script" stage of the job script 00:01 $ if [[ -z "$CI_COMMIT_TAG" ]]; then #…
0
votes
0 answers

No network connection from containers run within Docker-in-Docker container on MacOS

I've set up the dind image according to the instructions at https://hub.docker.com/_/docker How can the network be configured so that docker containers run from within the dind container will have access to the internet? Currently, wget, curl, and…
Brian M
  • 3
  • 1
  • 2
0
votes
0 answers

No connectivity to the dind container on OpenShift to build the docker images

I'm using an OpenShift Cluster provisioned on Azure (UPI) and running Jenkins instance to build Containers using dind. I have installed this plugin and it corectly Spin up the job container and everything works except the internet and dns inside the…
0
votes
0 answers

GitHub Container Actions in Containerised Runner

I have deployed a pool of self hosted GitHub runners as pods to my kubernetes cluster. Some of our pipelines contain jobs which run container actions. Is it possible to run those jobs in this type of runner? Docker in Docker is configured in the…
0
votes
1 answer

How do I re-share volumes between Docker-in-Docker containers?

I have mounted a volume shared to my service main. Now I am trying to mount that same volume to another container client, that is started with docker-compose up client from within the main container (Docker-in-Docker): version: "3.8" # set…
Corbie
  • 819
  • 9
  • 31
0
votes
1 answer

docker in docker via bind mound - ubuntu

I need to have an ubuntu image and then run a build process using that image. All is well until the build gets to the point of doing docker build etc. Lets say I use the following to test this: Dockerfile FROM ubuntu:latest I then build that -…
mieliespoor
  • 945
  • 2
  • 8
  • 23
0
votes
0 answers

Docker Showing Error: Cannot connect to the Docker daemon at unix:///var/run/docker.sock. Is the docker daemon running?

I am trying to run TeamCity CI Server within Docker DinD(Docker in Docker) by using a dockerfile. I am using the official docker:19-dind image as the base image. The main purpose is to create a DinD container and run TeamCity's official container…
0
votes
0 answers

how can you put images in a container (image) in advance?

I am using a dind image. Every time I create a container based on it, I have to download the images again, it takes a lot of time. The question is, how can you put images in a container (image) in advance? I've tried using Volumes and a couple more…
fabelx
  • 197
  • 1
  • 12
0
votes
1 answer

Gitlab-runner dind results in ERROR: Job failed (system failure): Error response from daemon: OCI runtime create failed: container_linux.go:380:

The executor for the project gitlab-runner is docker. I try to run docker-in-docker and I get the following Error from pipeline: ERROR: Job failed (system failure): Error response from daemon: OCI runtime create failed: container_linux.go:380:…
0
votes
1 answer

How can I get docker running in Jenkins nodes which are containers?

I am trying to get docker running on Jenkins which itself is a container. Below is part of the Pod spec. cyrilpanicker/jenkins is an image with Jenkins and docker-cli installed. For Docker daemon, I am running another container with docker:dind…
Cyril
  • 167
  • 1
  • 4
  • 11
0
votes
1 answer

Connect to docker container started inside Gitlab docker executor

We have a Gitlab setup with Sysbox (link to the setup) to avoid running the docker executor on priviledged mode. Currently the services attribute works and we can communicate to it, but containers started with dind are inaccessible. Here's a minimal…
luksfarris
  • 1,313
  • 19
  • 38