12

I have seen docker inside docker docker container for Ubuntu/Linux. As per the replies in this thread, the following command works

docker run -v /var/run/docker.sock:/run/docker.sock -v $(which docker):/bin/docker [your image

Are there any similar commands available for docker in Windows 7?

panch
  • 305
  • 3
  • 12

2 Answers2

22

I am using the below command in Windows 10 to run docker inside docker. The docker image is with alpine OS. Note that the path is //var/run/docker.sock

docker run -it --rm --privileged --name dockerindocker -v //var/run/docker.sock:/var/run/docker.sock docker

/ # docker ps
CONTAINER ID        IMAGE               COMMAND                  CREATED             STATUS              PORTS               NAMES
02285c22006f        docker              "docker-entrypoint..."   3 seconds ago       Up 2 seconds                            dockerindocker

/ # cat /etc/alpine-release
3.6.2
sayboras
  • 4,897
  • 2
  • 22
  • 40
  • Thanks. It works for me in PowerShell. Under Git bash it leaves without any error message or Docker event (`docker ev$`) – Karbos 538 Apr 05 '19 at 08:21
  • 2
    The problem this fixes is that `bash` on Windows automatically converts paths to Windows format, even when they aren't real local paths. Doubling the slash at the start of the path "escapes" it from this automatic conversion. The double slash in the path is not necessary when running in `cmd.exe` or Powershell, as those shells do not perform this conversion. – meustrus Oct 29 '19 at 22:22
2

Unfortunately Windows doesn't support true docker-in-docker yet.

All the answers here are about running a docker client in a container which connects to the top level docker server on the host (same docker running the container where you invoke docker from). It is not a real docker in docker.

See discussion here for more details https://github.com/docker-library/docker/issues/49