Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How /var/run/docker.sock works for windows Docker?

I have Docker installed on my Windows OS. There is my volumes filed of docker-compose.yml:

volumes:
  - "/var/run/docker.sock:/var/run/docker.sock"

I just can't figure out how /var/run/docker.sock::/var/run/docker.sock path works for windows as I have no /var/run/ on my windows files where I can find docker.sock. So how this volume binding works at all?

like image 438
O. Shekriladze Avatar asked May 09 '19 18:05

O. Shekriladze


1 Answers

The /var/run/docker.sock file on Docker for Mac and Windows for Linux images is inside the VM that Docker uses to run Linux containers. Those volume mounts happen from inside of that VM to the containers running in the VM. This is also why you can get an empty directory if you try to run a volume mount to a directory that you have not shared with the embedded VM.

You cannot see this file directly from the Windows environment (at least not that I'm aware of), though you can mount it into a container and see it that way.

For more details on how this VM is created, you can see the LinuxKit project: https://github.com/linuxkit/linuxkit

like image 90
BMitch Avatar answered Sep 21 '22 12:09

BMitch