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

Run webserver on Docker in Docker

I have the following Dockerfile: FROM ubuntu:bionic RUN apt-get update RUN apt-get -y install curl RUN apt-get install sudo # Install Miniconda ENV PATH="/root/miniconda3/bin:${PATH}" ARG PATH="/root/miniconda3/bin:${PATH}" RUN apt-get install -y…
gkv
  • 360
  • 1
  • 8
0
votes
1 answer

How to install kubernetes on a docker container?

Is this possible? I want to create an image to run a kubernetes worker inside a docker container. I tryed using dind images but it didn't work... Any ideas?
Caio Borghi
  • 76
  • 4
  • 10
0
votes
1 answer

Error response from daemon: bad format for link in gitlab ci

Question: In my gitlab CI my docker-in-docker job fails with the following message Preparing environment ERROR: Job failed (system failure): prepare environment: Error response from daemon: bad format for links:…
Ranunculum
  • 73
  • 1
  • 7
0
votes
1 answer

DockerInDocker build angular app fails - no such file or directory

In my GitLab CI I have this pipeline image: docker:stable variables: GIT_STRATEGY: clone DOCKER_HOST: tcp://localhost:2375 DOCKER_TLS_CERTDIR: "" DOCKER_DRIVER: overlay2 CONTAINER_RELEASE_IMAGE:…
Mauro Sala
  • 1,166
  • 2
  • 12
  • 33
0
votes
1 answer

How to write a Dockerfile to run another docker container

Recently we moved from gitlab shell executor to docker+machine executor. So now here comes the challenge, in my .gitlab-ci.yml I have couple of jobs like below: stages: - RUN_TESTS build-docker: stage: RUN_TESTS script: - echo "Running…
Jananath Banuka
  • 2,951
  • 8
  • 57
  • 105
0
votes
0 answers

Is there a way to give an unprivileged user access to Docker within Docker?

Motivation Running DDEV for a diverse team of developers (front-end / back-end) on various operating systems (Windows, MacOS and Linux) can become time-consuming, even frustrating at times. Hoping to simplify the initial setup, I started working on…
Pierre Spring
  • 10,525
  • 13
  • 49
  • 44
0
votes
0 answers

Why the customized docker container cannot connect to the Docker daemon at tcp://docker:2375?

For CI/CD purposes, I need docker in docker: docker network create some-network docker volume create some-docker-certs-ca docker volume create some-docker-certs-client docker run --privileged --name some-dind -d --network some-network…
HsnVahedi
  • 1,271
  • 3
  • 13
  • 34
0
votes
1 answer

Docker-in-Docker Pytest Failing with temp paths

We do all our development in containers, and one of our applications manages docker via docker-py in production. So testing becomes docker-ception (docker in docker). We mount the host docker.sock via compose for development (ie mount the volume…
EthanK
  • 600
  • 5
  • 17
0
votes
1 answer

Invalid bind address format: Connect to remote DOCKER_HOST via ssh from docker in docker

I am trying to use a remote DOCKER_HOST via ssh from a docker-in-docker container, like this: docker run --rm \ -e DOCKER_HOST=ssh://@ \ docker:18.06 \ docker ps But this returns an error: Invalid bind address format:…
clemens
  • 6,653
  • 2
  • 19
  • 31
0
votes
1 answer

How to pass insecure registry as args in pipeline using DIND image

can someone please let me know on how to pass insecure registry as an argument when using DIND image as runtime container. Please find the below sample script which i had been using as docker run time agent. ''' pipeline { agent {label…
0
votes
1 answer

'/bin/sh: go: not found' in 'docker:dind' container

I try to install Golang (go1.13.9.linux-amd64) in docker-in-docker container(docker:dind) manually (copy go binaries to a container). Go was copied to /go/bin, / # export GOROOT=/go / # export PATH=$GOROOT/bin:$PATH / # / # uname -a Linux…
kozmo
  • 4,024
  • 3
  • 30
  • 48
0
votes
1 answer

sandbox in ubuntu kubernetes

I created a vs code application and it works with docker on a new computer. Just after I created deployment and exposed app on kubernetes this error occurred: [0622/134831.833081:ERROR:nacl_helper_linux.cc(308)] NaCl helper process running without…
0
votes
0 answers

Docker DIND jenkins kubernetes - mounted directories are empty

Having a weird issue running dind on k8s when mounting volumes from host so I have docker which runs another docker container using host socket a specify -v command to that children docker but the mounted directory contains only .go directory. The…
kotyara85
  • 305
  • 3
  • 12
0
votes
3 answers

Permission denied with Docker in Docker in Atlassian Bamboo Server

I'm trying to build a docker image using DIND with Atlassian Bamboo. I've created the deployment/ StatefulSet as follows: --- apiVersion: apps/v1 kind: StatefulSet metadata: labels: app: bamboo name: bamboo namespace: csf spec: replicas:…
bear
  • 11,364
  • 26
  • 77
  • 129
0
votes
1 answer

Forward host gitlab-ci for dind

Problem: need to add some row (ex: 124.343.23.34 gitlab.example.com) to /etc/hosts for dind(docker in docker). Everything this in gitlab-ci.yml Current script: cache:build: stage: cache image: docker:dind services: - redis:latest -…