Skip to content

stack build (with docker) failing on macOS #3837

Open
@janvogt

Description

@janvogt

General summary/comments (optional)

Sharing the SSH-Agent socket on macOS does not work. The relevant code is introduced by this commit. I think this is not a specific stack problem, but a more general Docker for Mac one as mentioned in Docker for Mac's #419 and Docker for Mac's #483. But those do not seem to be fixed anytime soon (they are almost 1.5 years old). In the meantime, I think, it should still be possible to use stack's docker integration on macOS.

I see a few options for mitigations ordered by increasing complexity and increasing niceness:

  1. Make SSH-Agent sharing optional with a switch in stack.yaml and add that to the documentation
  2. Disable SSH-Agent sharing automatically on macOS hosts
  3. Use automatically one of the workarounds suggested in the docker issues on macOS hosts

Or, since this is my first time using docker, it might be that it is my fault after all. If I messed something up on my side, I think this is quite easy to do so, and would at least add some suggestions to the documentation. It took me a few hours of research and I am still not sure if I figured it out. Does the docker integration work for anyone on macOS?

Steps to reproduce

  1. Install Docker for Mac [stable] as suggested in Prerequisites
  2. Create new stack project e.g. stack new bug
  3. Enable docker integration in stack.yaml
docker:
  enable: true
  1. (optionally) get Docker images stack docker pull
  2. Try to build: stack build

Expected

I expected the project to be built.

Actual

$ stack build
Error response from daemon: Mounts denied:
The path /var/folders/46/vy3hn9b95cs__q_vvfb4p7gr0000gn/T//ssh-MDzJ2qaaUviD/agent.514
is not shared from OS X and is not known to Docker.
You can configure shared paths from Docker -> Preferences... -> File Sharing.
See https://docs.docker.com/docker-for-mac/osxfs/#namespaces for more info.

For verbose output see Gist

Stack version

$ stack --version
Version 1.6.3, Git revision b27e629b8c4ce369e3b8273f04db193b060000db (5454 commits) x86_64 hpack-0.20.0

Method of installation

I'm not sure. I don't think it is relevant.

Workaround

For now, I remove the offending environment variable on each stack call, like so:

$ SSH_AUTH_SOCK= stack build

which works for me, but completely disables ssh agent sharing.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions