Support windows named pipe
Feature request
Support Windows named pipe like this :
final DockerClient docker = new DefaultDockerClient("npipe:////./pipe/docker_engine");
Example in fabric8io docker maven plugin : https://github.com/fabric8io/docker-maven-plugin/blob/master/src/main/java/io/fabric8/maven/docker/access/DockerConnectionDetector.java#L123
Extract from Docker for Windows Faq
How do I connect to the remote Docker Engine API?
You might need to provide the location of the Engine API for Docker clients and development tools.
On Docker for Windows, clients can connect to the Docker Engine through a named pipe: npipe:////./pipe/docker_engine, or TCP socket at this URL: tcp://localhost:2375.
This sets DOCKER_HOST and DOCKER_CERT_PATH environment variables to the given values (for the named pipe or TCP socket, whichever you use).
Thanks for providing a link on how the named pipe can be accessed as a File, that is useful to know 👍
So would things just work if DefaultDockerClient just stripped "npipe:////./pipe/docker_engine" down to "//./pipe/docker_engine" and treated that as a file and talked to it like https://stackoverflow.com/a/2605884/553994. Hm might be a fair amount of work now that I look at how we talk to Unix sockets.
I wanted to give this a try, here is what I was able to do so far: https://github.com/hazsetata/docker-client/commit/446ef75c9ae9ad43c840f4de07cd4f3a30e9e7f7
It uses a RandomAccessFile and wraps it in a Socket (supporting only the bare minimal things that are needed to make this work). I then created a SocketFactory very similar to the Unix socket implementation's and modified DockerHost / DefaultDockerClient to support it.
It compiles, runs but some of the tests hang. I'm not sure yet what causes that, one possibility that I'll have to check is that because the code uses a file, the read() methods do not timeout (with a real Socket they would). If supporting that is a requirement, I'm not sure yet how to proceed.
Any comments / ideas would be very welcome!
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.
As far I understand, this issue still hasn't been fixed. Could someone reopen it, then?
Hi, i'm author of npipe implementation in fabric8io/docker-maven-plugin that you mentioned, see https://github.com/fabric8io/docker-maven-plugin/commit/8112cdf981f28bbdcdb423731678e683e1b34e8f#diff-1fec0d18db7198d4e068ea33ca319dca. I'll rewrite it for this project, PR coming soon ...
Implemented in PR #1114, works just fine on my Win 10 machine.
@jan-zajic I am sorry I know this is old, but do you remember why you used a BasicHttpClientConnectionManager instead of PoolingHttpClientConnectionManager? Is it a limitation of npipe?
We have problems on Windows because we need concurrent connections to docker but this only supports one (IllegalStateException: Connection is still allocated).