Description
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:
- Make SSH-Agent sharing optional with a switch in stack.yaml and add that to the documentation
- Disable SSH-Agent sharing automatically on macOS hosts
- 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
- Install Docker for Mac [stable] as suggested in Prerequisites
- Create new stack project e.g.
stack new bug
- Enable docker integration in
stack.yaml
docker:
enable: true
- (optionally) get Docker images
stack docker pull
- 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.