Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add Support for communication to docker hosts using UNIX domain sockets #179

Closed
wants to merge 1 commit into from
Closed

Conversation

twz123
Copy link
Contributor

@twz123 twz123 commented May 25, 2015

This is my draft to a solution for #148. The same technique is used by the Spotify plugin. No obscure packaging involved.

  • Use jnr-unixsocket for native OS-level access
  • Use a pseudo socket class that mimics a Java network socket and delegates to the jnr channel where applicable
  • Provide a special ApacheUnixSocketHttpDelegate that enables the Apache HTTP client to use that pseudo socket for HTTP communication

@rhuss
Copy link
Collaborator

rhuss commented May 25, 2015

Awesome! Thanks a lot. Do you know any limitations of jnr-unixsocket ? (i.e. does it run on any Unix or are there are limitations ? Just to add it to the docs in case).

BTW, whould you mind to signoff the PR ? (as explained here). Shouldn't be much more than a git commit -s --amend on this branch. Thanks !

I will review and integrate it ASAP, probably this week.

  * Use jnr-unixsocket for native OS-level access
  * Use a pseudo socket class that mimics a Java network socket and delegates to the jnr channel where applicable
  * Provide a special ApacheUnixSocketHttpDelegate that enables the Apache HTTP client to use that pseudo socket for HTTP communication

Signed-off-by: Tom Wieczorek <tom@bibbu.net>
@twz123
Copy link
Contributor Author

twz123 commented May 25, 2015

No, I don't have any deeper knowledge of jnr-unixsocket. The only two things I can state about it:

  • Spotify uses it in their docker plugin
  • It simply just worked on first shot when implementing this PR

Added the signoff.

@rhuss
Copy link
Collaborator

rhuss commented May 29, 2015

Thanks ! Give me some days for the review, won't make it this week but hopefully the week after.

Thanks again ...

rhuss added a commit that referenced this pull request Jun 14, 2015
@rhuss
Copy link
Collaborator

rhuss commented Jun 14, 2015

Merged it into the integration with some slight modifications:

  • Detangled inheritance hierarchy
  • Avoid encoding the socket path as an URL host name. Instead set the path directly in the constructor of UnixSocketFactory. The base URL (host & port) is now meaningless and set to a dummy value.
  • If no DOCKER_HOST is set or configured, and a file /var/run/docker.sock exists, takes this as a default.

Again, thanks a lot ! Especially for finding out how Apache HC works nicely with a Unix Socket.

The next release 0.12.0 containing the changes will come next week.

@rhuss rhuss added the applied label Jun 14, 2015
@rhuss rhuss added this to the 0.12.0 milestone Jun 14, 2015
rhuss added a commit that referenced this pull request Jun 14, 2015
@rhuss rhuss closed this Jun 14, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants