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

Docker COPY newly created file in gitlab pipeline fails

My Dockerfile includes a COPY command which copies a directory that was just created in the pipeline. COPY ["$CI_PROJECT_DIR/ui-dist/", "/content/ui-dist/"] That COPY command fails with the following error: COPY failed: stat…
chris.va.rao
  • 373
  • 1
  • 10
0
votes
0 answers

Gitlab-CI dind and docker service are broken

Description I can't start docker container with dind anymore, I use Gitlab-CI and it used to work. My .gitlab-ci.yml looks like this: image: kopaxgroup/node10-jdk8-flyway4-sonarscanner2-docker17-debian before_script: - export…
Dimitri Kopriwa
  • 13,139
  • 27
  • 98
  • 204
0
votes
0 answers

How to get access the corporate docker hub inside docker-in-docker?

I have a corporate proxy and docker registry(nexus). When I execute the command: docker login -u -p https://nexus-corporate.com, I get a successful connection. But when I use docker-in-docker image and execute a similar…
0
votes
0 answers

Docker in docker routing within Kubernetes

I've network related issue on the Kubernetes host, using Calico network layer. For continuous integration I need to run docker in docker, but running simple docker build with this Dockerfile: FROM praqma/network-multitool AS build RUN route RUN ping…
Jan Zahradník
  • 2,417
  • 2
  • 33
  • 44
0
votes
2 answers

docker: no space available on tmp

I'm using docker-dind inside my openshift. I'm running against an issue related with no enought disk space. It means that docker is getting me: Error starting daemon: Unable to get the TempDir under /var/lib/docker: mkdir /var/lib/docker/tmp: no…
Jordi
  • 20,868
  • 39
  • 149
  • 333
0
votes
1 answer

Where should c++ application be compiled in GitLab CI Docker workflow?

I’m looking to understand how to properly structure my .gitlab-ci.yml and Dockerfile such that I can build a C++ application into a Docker container. I’m struggling with where the actual compilation and link of the C++ application should take place…
0
votes
1 answer

Permission denied /var/run/docker.sock when running docker from docker

I have a container inside which I need to use another container (the first container holds my build env, and some of the projects are built by creating a container). I read about avoiding docker-in-docker, and followed the advice here:…
user907323
  • 50
  • 6
0
votes
2 answers

No such image in gitlab-ci with docker-in-docker

I'm use docker-api in my rails project. I'm need create containers with my custom image. .gitlab-ci.yml: variables: DOCKER_DRIVER: overlay2 DOCKER_TLS_CERTDIR: "" DB_HOST: postgres RAILS_ENV: test build: stage: build image:…
0
votes
2 answers

Cannot connect to the Docker daemon without -v /var/run/docker.sock:/var/run/docker.sock

I am trying to run docker inside docker container and container have nodeJs App. Here is my Dockerfile: FROM docker:dind WORKDIR /app RUN apk add --update nodejs nodejs-npm COPY . /app RUN npm install CMD node app.js EXPOSE 4000 I…
Priya Rani
  • 1,063
  • 3
  • 11
  • 21
0
votes
1 answer

Unable to run nginx inside docker

I am trying to run an nginx image inside a Docker container. I have tried these steps ssh inside ubuntu docker image docker run -v /var/run/docker.sock:/var/run/docker.sock -it ubuntu:latest bash Installed Docker Run Nginx image docker run -d -p…
0
votes
1 answer

How to get the name of the Docker network in a Docker-compose stack from within the containers?

I have a Docker Compose stack application. One function of the application is that it has a .NET Core backend running as a container in the stack which is able to spawn new temporary containers running data processing tasks. These containers need to…
fdmillion
  • 4,823
  • 7
  • 45
  • 82
0
votes
1 answer

Container in dind access another container in the same Kubernetes pod

In a Kubernetes pod, I have: busybox container running in a dind container fluentd container I understand if dind wants to access fluentd, it needs to simply connect to localhost:9880. But what if busybox wants to access fluentd as the depicted…
aldred
  • 743
  • 3
  • 9
  • 19
0
votes
1 answer

Cannot connect to dockerhost from docker image

I am trying to use docker(dind) image for building an image. When I run docker info in the DockerFile, it complains dockerhost cannot be found. Is there any way when building a Docker image, can we use docker host in the build step ?
Prasanth
  • 507
  • 2
  • 10
0
votes
1 answer

dind: Registry mirror is ignored

I am using a dind (docker in docker) image and I spin this up with the following parameters in order to provide an internal proxy repo for dockerhub --insecure-registry=internalrepo.intra:5002 /…
papanito
  • 2,349
  • 2
  • 32
  • 60
0
votes
0 answers

How to fix SSL Certificate Verification Error for a Gitlab CI build that uses docker in docker (dind) service for Python 3.x Architecture?

I am receiving SSL Certificate Verification Error from a gitlab CI build that uses docker in docker within a Python 3.x architecture. All CI build images are alpine linux based. I have setup a CI Python 3.x test job that uses Pytest. Pytest spawns a…
dcs3spp
  • 493
  • 1
  • 9
  • 23