How to install docker in docker container? How to install docker in docker container? docker docker

How to install docker in docker container?


I had a similar problem trying to install Docker inside a Bamboo Server image. To solve this:

  1. first remove the line: RUN docker run hello-world from your Dockerfile
  2. The simplest way is to just expose the Docker socket, by bind-mounting it with the -v flag or mounting a volume using Docker Compose:

docker run -v /var/run/docker.sock:/var/run/docker.sock ...


Use Docker-in-Docker for this task. They have already solved many of the problems for you.


The easiest way is to use the official Docker-in-Docker images from https://hub.docker.com/_/docker/ with the :dind tag (which is the successor of the project Hendrikvh already mentioned).

You definitely need to use the --priviledged flag also:

docker run --privileged --name yourDockerContainerNameHere -d docker:dind

With that your Docker-in-Docker experiments should work - but be aware of the many stumbleblocks that could be in your way: https://jpetazzo.github.io/2015/09/03/do-not-use-docker-in-docker-for-ci/