Skip to content

Support for sharing unix sockets #483

Closed

Description

@BouncyLlama

Expected behavior

When mounting a directory containing unix sockets the sockets should function the same as they do on a Linux host.

Actual behavior

The socket is 'there', but non-functional.

Information

After reading several forum threads, it appears that there is a workaround with socat over TCP, but this is rather slow.

The documentation has this to say: 'Socket files and named pipes only transmit between containers and between OS X processes -- no transmission across the hypervisor is supported, yet'
Hopefully this is a planned feature already, but I did not see any existing issues open in this tracker for this particular issue, although it relates to #410 which asks specifically for SSH_AUTH_SOCK to be supported.

Host OS: Mac OSX 10.10.5

Steps to reproduce the behavior

  1. mount a directory containing unix sockets like so: '-v "/directorywithsockets:/otherdirectory"'
  2. attempt to send data to/from the host/container via the socket

Activity

  1. dsheets commented on Sep 1, 2016

    @dsheets
    Contributor

    This is on the roadmap.

  2. udondan commented on Sep 19, 2016

    @udondan

    Interestingly, even a socket created in the container is non-functional if it was created on a mounted volume of the host.

  3. jippi commented on Oct 15, 2016

    @jippi

    Any ETA on this? :)

    Currently it's blocking hashicorp/nomad#1091 and other projects :)

  4. dsheets commented on Oct 15, 2016

    @dsheets
    Contributor

    This is currently scheduled for resolution in November. Sorry for the delay.

  5. jippi commented on Oct 15, 2016

    @jippi

    @dsheets okay, will it be available in beta builds beforehand?

  6. dsheets commented on Oct 15, 2016

    @dsheets
    Contributor

    Our goal is to ship it in beta builds in November.

  7. jippi commented on Oct 15, 2016

    @jippi

    amazing @dsheets - if you need any testing or otherwise beforehand, I'm willing to help out!

  8. Druotic commented on Oct 28, 2016

    @Druotic

    Our goal is to ship it in beta builds in November.

    @dsheets That statement makes me think the work for this is already underway. However, the status label is still "1-acknowledged". Is this currently being worked on, or still on the todo list?

  9. BlinkyStitt commented on Nov 9, 2016

    @BlinkyStitt

    We are in November now :) Any guess when this will be in Beta? This feature blocks a lot for us.

  10. Druotic commented on Nov 16, 2016

    @Druotic

    Any updates? Even a mention that this feature has been abandoned would be better than nothing.

  11. 124 remaining items

  12. unilynx commented on Jun 7, 2020

    @unilynx

    @unilynx

    Most people will only want unix sockets for ssh agent forwarding

    Most, but certainly not all.

    The main issue for my personal use case is that I don't want ports exposed on the host. Instead, I would like a container port to be exposed on a UNIX socket and then use nginx to forward that UNIX socket to a certain hostname:

    Why not publish the ports bound to only 127.0.0.1 ?

    (I haven't personally tested with 127.0.0.1, but I do run a few dockers with their ports published to an alias 10.x.x.x address I've assigned to the localhost interface)

  13. dancojocaru2000 commented on Jun 7, 2020

    @dancojocaru2000

    The port would still be bounded.

    Still, haven't thought about that approach! Thanks for reminding me I can probably do that!

  14. benlangfeld commented on Jun 7, 2020

    @benlangfeld

    How exactly would an overlay network help in my case?

    Your nginx instance would have interfaces on both the overlay and the external networks.

  15. trinitronx commented on Jun 22, 2020

    @trinitronx

    I definitely see another use case with $HOME/.gnupg/S.gpg-agent* sockets:

    Building software inside a Docker container, and GPG signing the resulting build artifacts with a Yubikey plugged into the host OS. For example: Building a Debian package withdebuild + export DEBUILD_DPKG_BUILDPACKAGE_OPTS="-sa -k${DEBSIGN_KEYID}"

    This would need access to the gpg-agent socket for signing the package & .dsc, .changes, and .buildinfo files.

  16. rkettelerij commented on Dec 9, 2020

    @rkettelerij

    This is indeed very much needed in order to securely use GPG within Docker. GnuPG gpg-agent offers an extra domain socket which you can forward from the host to your container and hence use GPG inside the container. Lot's of stuff (e.g. pass or gopass, password manager) integrates with GPG so this isn't an exotic use case IMHO.

    Since SSH forwarding works now, what would it take to make this work for GPG?

  17. AndreaCensi commented on Dec 20, 2020

    @AndreaCensi

    I am not sure I understand one thing: /var/run/docker.sock is a socket, right? and that one socket can be mounted in the containers, arbitrarily deep. Is that a special case that is different from user-created sockets?

  18. added a commit that references this issue on Jan 10, 2021
  19. stephen-turner commented on Jan 12, 2021

    @stephen-turner
    Contributor

    Sorry to disappoint everyone, but I'm closing this ticket as "Won't Fix". The main use case has been solved in #410. As described in recent comments, the general case is too hard / impossible, and is realistically never going to be done.

  20. Vanuan commented on Jan 13, 2021

    @Vanuan

    @stephen-turner what's the current state of osxfs? Is it stiil being used? There's been a talk about open sourcing it several years ago.

  21. stephen-turner commented on Jan 14, 2021

    @stephen-turner
    Contributor

    It's still in the product at the moment, but is being replaced because of a lot of problems with it, particularly high CPU usage. There is no intent to open source it.

  22. docker-robott commented on Feb 13, 2021

    @docker-robott
    Collaborator

    Closed issues are locked after 30 days of inactivity.
    This helps our team focus on active issues.

    If you have found a problem that seems similar to this, please open a new issue.

    Send feedback to Docker Community Slack channels #docker-for-mac or #docker-for-windows.
    /lifecycle locked

  23. locked and limited conversation to collaborators on Feb 13, 2021
  24. djs55 commented on Aug 17, 2026

    @djs55
    Contributor

    For anyone still waiting on this, try the latest Docker 4.87, ensure you're using Docker VMM:

    Image

    Ensure you have the system process com.docker.sailor running (otherwise the feature flag might not be enabled -- try restarting to see if it syncs):

    % ps uax | grep com.docker.sailor
    djs55            36002   0.2  3.3 499666000 1240224   ??  S    11:28a.m.   6:48.88 /Applications/Docker.app/Contents/MacOS/com.docker.sailor
    djs55            58110   0.0  0.0 488781904   1424 s007  S+    6:54p.m.   0:00.00 grep com.docker.sailor
    

    and then AF_UNIX sockets should work over docker run -v. Let me know if you hit issues: open a new issue with a repro case and ping me.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions