Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Docker Inside a Docker on Windows

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?

like image 575
panch Avatar asked Nov 10 '17 14:11

panch


People also ask

Can I install Docker inside Docker?

Yes, we can run docker in docker, we'll need to attach the unix socket /var/run/docker. sock on which the docker daemon listens by default as volume to the parent docker using -v /var/run/docker.

Can you work inside a Docker container?

Once you have your Docker container up and running, you can work with the environment of the Docker container in the same way you would do with an Ubuntu machine. You can access the bash or shell of the container and execute commands inside it and play around with the file system.

Can I run a Linux Docker container on Windows?

Docker has been able to run Linux containers on Windows desktop since it was first released in 2016 (before Hyper-V isolation or Linux containers on Windows were available) using a LinuxKit based virtual machine running on Hyper-V.


1 Answers

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
like image 112
sayboras Avatar answered Sep 17 '22 23:09

sayboras