Docker for Windows volume mounts and docker.sock
See original GitHub issueMounting /var/run/docker.sock
is no longer working in stable Docker for Windows with the latest update. There is an issue here: https://github.com/docker/for-win/issues/1829
I’m not sure whether the issue is that docker.sock
file is no longer a reliable source for DFW, and if that is the case then the issue will have to be resolved here. However, if it’s a bug and it should still be able to mount docker.sock
on the Docker for Windows side of things, this bug should resolve itself in a future update.
An example error is here:
ERROR: for front Cannot create container for service front: b'Mount denied:\nThe source path "\\\\var\\\\run\\\\docker.sock:/tmp/docker.sock"\nis not a valid Windows path'
Example docker-compose.yml
:
front:
restart: always
image: jwilder/nginx-proxy
volumes:
- /var/run/docker.sock:/tmp/docker.sock
ports:
- "80:80"
- "443:443"
Docker Version: 18.03.0-ce-win59
Issue Analytics
- State:
- Created 5 years ago
- Reactions:6
- Comments:9
Top Results From Across the Web
Bind to docker socket on Windows - Stack Overflow
On *nix systems, it is possible to bind-mount the docker socket from the host machine to the VM by doing something like this:...
Read more >Running Docker in Docker on Windows (Linux containers)
mounting a volume to allow access to the Docker socket; adding the root group to the Jenkins user. To install the Docker CLI...
Read more >Bind mount docker.sock with Windows container #6813 - GitHub
I'm trying to mix Windows and Linux containers and as you might know, the latest version that it works properly is 2.2.0.3 (based...
Read more >Volumes - Docker Documentation
New volumes can have their content pre-populated by a container. Volumes on Docker Desktop have much higher performance than bind mounts from Mac...
Read more >Bind mounts - Docker Documentation
Bind mounts have limited functionality compared to volumes. When you use a bind mount, a file or directory on the host machine is...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
@padhie I think the misunderstanding is that setting this variable just happens to fix the problem by changing the way paths are parsed. It’s not mapping this path to Windows in any way. This directory doesn’t exist in Windows, it exists in the Hyper-V VM (Linux). Hopefully, this will help you understand. When you open Docker for Windows “Settings” and go to “Shared Drives”, it helps you demonstrate the shared drive is working by entering this command:
What it then does, is automatically changes C:/Users to /c/Users in the background to demonstrate that C:\Users is correctly mounted within the Linux VM, and passed on to the container you create. What it doesn’t tell you, is there is a way to prevent that from happening, and by doing that you can prove that you’re actually mounting the drive from Linux to the Container. Using two slashes allows you to circumvent this conversion.
Now you’ll see a Linux root directory, with folders like
var
,opt
,etc
.Now you’ll see that there is a
docker.sock
There was a workaround found in docker/for-win#1829
Add an this environment variable:
COMPOSE_CONVERT_WINDOWS_PATHS = 1
Or from Powershell run
$Env:COMPOSE_CONVERT_WINDOWS_PATHS=1