Can we re-use the OSX ssh-agent socket in a container?

Another thing you can do in ssh-find-agent.sh is create a symbolic link to ${SSH_AUTH_SOCK} – instead of setting and reading in the path, you can assume it always exists in /tmp/agent.sock.

ln -sf $SSH_AUTH_SOCK /tmp/agent.sock

then…

docker run -it \
  -v ${LOCAL_STATE}:/tmp \
  -e SSH_AUTH_SOCK=/tmp/agent.sock \
  golang ssh -T git@github.com

This has also made defining the path in compose files quite trivial…