Skip to content
This repository has been archived by the owner on Mar 21, 2022. It is now read-only.

Support windows named pipe #875

Closed
philippe-granet opened this issue Aug 26, 2017 · 8 comments
Closed

Support windows named pipe #875

philippe-granet opened this issue Aug 26, 2017 · 8 comments
Labels
enhancement help wanted pinned exempt from being marked as stale

Comments

@philippe-granet
Copy link

philippe-granet commented Aug 26, 2017

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).
@mattnworb
Copy link
Member

Thanks for providing a link on how the named pipe can be accessed as a File, that is useful to know 👍

@davidxia
Copy link
Contributor

davidxia commented Nov 13, 2017

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.

@hazsetata
Copy link

I wanted to give this a try, here is what I was able to do so far: hazsetata@446ef75

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!

@stale
Copy link

stale bot commented Sep 24, 2018

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.

@stale stale bot added the stale label Sep 24, 2018
@stale stale bot closed this as completed Oct 1, 2018
@php-coder
Copy link

As far I understand, this issue still hasn't been fixed. Could someone reopen it, then?

@davidxia davidxia reopened this Oct 9, 2018
@stale stale bot removed the stale label Oct 9, 2018
@davidxia davidxia added the pinned exempt from being marked as stale label Oct 9, 2018
@jan-zajic
Copy link
Contributor

Hi, i'm author of npipe implementation in fabric8io/docker-maven-plugin that you mentioned, see fabric8io/docker-maven-plugin@8112cdf#diff-1fec0d18db7198d4e068ea33ca319dca. I'll rewrite it for this project, PR coming soon ...

jan-zajic added a commit to jan-zajic/docker-client that referenced this issue Nov 20, 2018
Signed-off-by: jzajic <[email protected]>
@jan-zajic
Copy link
Contributor

Implemented in PR #1114, works just fine on my Win 10 machine.

jan-zajic added a commit to jan-zajic/docker-client that referenced this issue Nov 20, 2018
Signed-off-by: jzajic <[email protected]>
jan-zajic added a commit to jan-zajic/docker-client that referenced this issue Nov 27, 2018
jan-zajic added a commit to jan-zajic/docker-client that referenced this issue Nov 27, 2018
davidxia added a commit that referenced this issue Nov 27, 2018
lasselindqvist added a commit to lasselindqvist/dockerfile-maven that referenced this issue Mar 20, 2019
This update fixes issue described here spotify/docker-client#875 about supporting Windows named pipes.
@joffrey-bion
Copy link

joffrey-bion commented May 5, 2021

@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).

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
enhancement help wanted pinned exempt from being marked as stale
Projects
None yet
Development

No branches or pull requests

7 participants