Roman Iuvshin
Roman Iuvshin

Reputation: 1912

docker for windows how to access docker daemon from container

Im running Docker Desktop for Windows (hyper V) and I need to access docker daemon from the container via tcp. It is possible to connect to it from the host like: curl -v 127.0.0.1:2375/info but not possible to access it from a container using my host IP address. Maybe someone knows how to do that or at least how to ssh to that docker vm, for example it is possible to ssh in to it on mac by executing: screen ~/Library/Containers/com.docker.docker/Data/com.docker.driver.amd64-linux/tty

Upvotes: 4

Views: 1944

Answers (1)

Roman Iuvshin
Roman Iuvshin

Reputation: 1912

I've figured how to do that using socat tool which takes docket.socket and proxy TCP calls to it.

So I've launched container with a socat which mount docker.sock since it is available inside of a VM and expose 2375 port:

docker run -p 2375:2375 -v /var/run/docker.sock:/var/run/docker.sock codenvy/socat -d -d TCP-L:2375,fork UNIX:/var/run/docker.sock

With that now, I'm able to access docker daemon API through socat container.

Upvotes: 2

Related Questions