-
Notifications
You must be signed in to change notification settings - Fork 2k
SSH forwarding inside Machine #2439
Comments
Hi @joecorcoran the issue is that you are trying to mount the ssh agent socket. This is not possible out of the box with Virtualbox driver. The Virtualbox driver creates a vm with one shared folder. This folder is |
SSH is configured correctly within the virtual machine though, so whatever forwarding Docker Machine does is working fine. The issue seems to be at the border between virtual machine and container. I don't understand the difference between my two scenarios above. Why does starting the container manually work, but starting it via Docker Compose not work? I would expect that |
I think I understand this better now. So the issue is that Moving my SSH socket into Is there a way of passing environment variables from the Docker Machine (not the host) into Docker containers? I think that would solve this problem. |
@joecorcoran How are you setting |
With |
I have forwarding enabled in my host machine SSH config. No explicit attempt to set |
Would bind mounting |
There isn't, no - I'm not sure it would be a good idea in general, from the perspective of leaky abstractions. There's some related discussion on this in docker/compose#551 and moby/moby#6396. It looks like the general problem of SSH forwarding into a Docker container, when Docker's running in a VM, has not been solved satisfactorily. Here's something which might work:
|
Going to close this as SSH forwarding works fine in Machine VMs, and getting it into a container is the issue. |
@aanand Your solution works, in that it gets SSH running inside the container. Not ideal though, in that the SSH session with forwarding enabled has to remain open, which makes the settings in Good to know that it's all fundamentally possible, but would be great as a proper Compose feature. Not exactly sure what that feature would look like. Thanks for your help everyone. 🙇 |
Firstly, sorry if this is posted in the wrong project – I wasn't sure if it belonged here or in Compose.
I'm having trouble getting SSH forwarding to work with Docker/Machine/Compose. First I create a new machine.
I have the following, seemingly simple config for an Ubuntu container and Compose.
The idea behind the environment variable and mounted volume is that the SSH socket
from the virtual machine is accessible from within the container.
When I test it out via Compose, I can't connect to the SSH agent.
However, when running Docker from within the virtual machine, everything is fine.
Both scenarios used to work in my previous setup, with a Vagrant virtual machine in place of Docker Machine. What's the difference here?
The text was updated successfully, but these errors were encountered: