OK, we can run Docker in Docker. There are many problems with it. See this post. So it is adviced to use hosts Docker to run child containers as described under solution. So they are not childs of the docker container but from the host. So they are siblings of the parent docker container. I did it but now all the pathes are not working as assumed at first.

For example in the first Docker container I use a volume. In the second Docker container I use another volume within the first volume. Now the second container doesn't use a path relative to the first container. As all containers run on the same instance of Docker directly on the host they use pathes relativ to this host.

  • Hosts working dir is /home/user/theDockerThing
  • Volume in first container: .:/var/mydata
  • In first container the working dir is /var/mydata/someproject
  • Volume in second container: .:/var/www/html

What I want is the directory from the host: /home/user/theDockerThing/someproject bind mounted to the second container to /var/www/html

But in /var/www/html I get /var/mydata/someproject where is nothing.

I don't want to edit the second dockers configuration as this docker also should run directly on another host.

How to tell the second docker container to use the first ones volumes to make it more like a real Docker-in-Docker?

1 Answer 1


Since all the containers run actually on the same docker daemon, you cannot map the first level dind's volumes. You should map volumes with the host's paths.

Give volumes in the second level dind not as -v /var/mydata/someproject:/var/mydata, but as -v /home/user/theDockerThing/someproject:/var/mydata

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .