1
votes

Problem

OS: Windows 10 I cannot run code bellow in git bash.

Tried using it with winpty but does not help. If I run it from cmd, it has no issues, but that is not a solution because I have a lot of commands in .sh format, so I need bash functionality. I googled the problem, but solutions are only to run from cmd.

Code below is one line

docker run  -v /var/run/docker.sock:/var/run/docker.sock -d --
publish=127.0.0.1:8000:80 --network net_basic gliderlabs/logspout

Results

I expect something similar to that:

docker run -v /var/run/docker.sock:/var/run/docker.sock -d --publish=127.0.0.1:8000:80 --network net_basic gliderlabs/logspout

249a69afcdb3d80e4783c439083ec1ffd30946ccec77f2b64f66a0b41afe29e7

I get that:

docker run -v /var/run/docker.sock:/var/run/docker.sock -d --publish=127.0.0.1:8000:80 --network net_basic gliderlabs/logspout

C:/Program Files/Docker/Docker/Resources/bin/docker.exe: Error response from daemon: Mount denied: The source path "C:/Program Files/Git/var/run/docker.sock;C" doesn't exist and is not known to Docker. See 'C:/Program Files/Docker/Docker/Resources/bin/docker.exe run --help'.

2

2 Answers

4
votes

Check the error. Your gitbash tried to be smart and appended path to your git at the begging : C:/Program Files/Git/var/run/docker.sock. It is a bug/feature discussed here. A quick workaround would be to mount docker.sock like this :

-v //var/run/docker.sock:/var/run/docker.sock

So your full command will be :

docker run -v //var/run/docker.sock:/var/run/docker.sock -d --publish=127.0.0.1:8000:80 --network net_basic gliderlabs/logspout
0
votes

This smells to me like you didn't share your drive in Docker settings. Right click on Docker icon in system tray and select Settings. After that go to "Shared Drives" and select a drive you want to share with Docker daemon and click "Apply".

Docker for Windows is buggy sometimes and if that doesn't work from first, just restart Docker and it should work.