Reputation: 5855
I'm trying to control the host docker service from inside a container.
With Linux host and Linux container that is usually done like this:
docker run -it -v /var/run/docker.sock:/var/run/docker.sock alpine
I now want to achieve the same with a Docker for Windows
host and a Linux container.
If tried quite a lot of things, mostly using DOCKER_HOST
with varying IP's like 10.75.0.1:2375
(IP of docker VM), 172.17.0.1:2375
(container IP) and 0.0.0.0:2375
as well as 192.168.178.xxx:2375
(host IP).
But apparently nothing responds on port 2375
or 2376
which I checked with something like:
docker run -ti --rm alpine /bin/sh -c "apk add -U nmap && nmap -Pn 10.72.0.1 -p 2375-2376"
At this point I'd like to know if this is even possible with Docker for Windows. Most information I found concerns docker-machine / VirtualBox
combinations.
Upvotes: 7
Views: 3307
Reputation: 4333
To complement the answer by @friism:
Just ensure that your shell won't rewrite paths or similar.
This was happening to me within Git Bash on Windows. The solution, in this case, was to prefix all absolute paths with an extra slash (/
) to disable the automatic path rewriting done by Git Bash. (Source)
Upvotes: 0
Reputation: 21
I don't know how SO works so if necroposting is frowned upon then sorry. I also don't use docker on windows but this thread came up during my search for setting up portainer. I figured out the thing that I wanted to figure out and on first login portainer gave me this warning:
Ensure that you have started the Portainer container with the following Docker flag:
-v "/var/run/docker.sock:/var/run/docker.sock" (Linux).
or
-v \\.\pipe\docker_engine:\\.\pipe\docker_engine (Windows).
So, there you go. Hope that helps.
Upvotes: 2
Reputation: 19279
This works fine when running Linux containers using Docker for Windows too (but not when running Windows containers). Just ensure that your shell won't rewrite paths or similar.
Upvotes: 6