-
Notifications
You must be signed in to change notification settings - Fork 57
Socat-based approach #10
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
base: master
Are you sure you want to change the base?
Conversation
(because that's what it is now)
On OSX, I'm getting an error:
|
What's the benefit of a volume based approach? What's the benefit of socat? It's still using sshd, right? Isn't that just increasing the size of an image without a clear benefit? |
Could you draw a picture similar to #11 to specify improvements? |
@wysenynja Ah, forgot to add the fix for OSX. New version should work! |
@Vanuan This approach has two benefits. Since it uses a named volume instead of a bind-mounted one, it doesn't need the user's home directory mounted into the docker machine (as it is needed with docker-machine/boot2docker on Linux, for example). The volume is shared between the (remote) containers only. That means it can work with any local or remote Docker host as long as client access is configured correctly (e.g. using docker-machine). In order to share the socket (and because I didn't want share the whole I will try to draw a diagram in order to illustrate this in a spare moment. |
@Vanuan I just added a diagram. Hope it is clear enough. |
Nice, looks good. I just came across this PR, having implemented the same thing in a private repo last Monday too, needing it working with Docker for Mac as well as docker-machine / boot2docker. I didn't like the sshd container's And depending on I wasn't sure about generating the SSH host keys ( So, this PR would mean I could delete my own code 👍 |
I've included this and more in https://github.com/uber-common/docker-ssh-agent-forward |
Apparently mktemp is different on Yosemite and doesn't work without any args:
On my fork, I've changed it to |
FIXME Find a way to ensure sshd is ready without waiting an arbitrary second.
@pda Very valid point! Just changed this accordingly. I had to add a workaround in waiting for sshd to become readily available though.
@wysenynja Adjusted that, too. |
I made my fork stand alone and added an example docker compose config: https://github.com/djmaze/docker-ssh-agent-forward |
@djmaze I'm curious about your diagram for the Not clear from it: where does Should the following part of the image: Second: |
@tamsky The agent needs to be running on your host machine.
|
@avsm Thanks for the great idea you had here!
I changed this so it doesn't need local volumes anymore. This makes it work with boot2docker on Linux as well. Even more, it works with any remote docker host as long as the
DOCKER_
variables are set up correctly.Also, it forwards all keys available in the local agent.
Last but not least, it uses a named volume so it can be used with Docker Compose V3 syntax. See this example.
For me, this is now close to a perfect solution for SSH agent forwarding.
EDIT: Sorry for the bad PR name, I was unable to come up with a good one. Also, this could probably be split into multiple PRs. But for me this really is useful as a whole only.