-
Notifications
You must be signed in to change notification settings - Fork 524
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
In order to use an SSH DOCKER_HOST on OS X and Linux, you must configure an ssh-agent. #1459
Comments
Some of the manipulation of environment variables related to SSH is due limitations in the way |
Yep, and dockerode does not seem to respect |
Nonetheless, I would appreciate a possibility to customize value of |
Dockerode indeed does not respect it, unfortunately; Dockerode is using the ssh2 node package which does not use |
Do you think it makes sense to implement this part here? |
Sorry, so, does it support ssh with a jump host ? |
@lcxywfe it may be possible to use a jump host but we have never tried it. |
@bwateratmsft I mean, could tell me how to modify the DOCKER_HOST (or another variable) to use a jump host. |
It seems like ssh2 already supports specifying an agent, there's just no way to specify ssh2 options in vscode-docker and have them provided to the ssh2 client.
It seems like the missing link is just that (one way to specify those options might be to read them from |
@steverice this is already possible, it's what the |
@bwateratmsft Secondly, it is not always true that socket changes at every reboot. If agent runs as |
On Windows, you need to set up OpenSSH (more info here). On Windows with OpenSSH as the SSH agent, it's always Because the path is always predictable on Windows, if For those that use the In any case, I'd like to point out that using an |
You described the cases when vscode is used
I was talking about WSL - Remote configuration, more info here and especially here, Good point regarding Remote - SSH extension though |
Just to make sure I understand your scenario correctly, are you using Remote - WSL to connect to WSL, but the Docker daemon is running somewhere else and you need to use SSH to get to it? Or is Docker also running in WSL? |
Correct, docker is running elsewhere. P.S. (offtopic) Docker cannot run on WSL locally, unless it is "WSL 2" which is not publicly available yet. |
Gotcha. For WSL, at least the Ubuntu flavor, you can accomplish this by putting something like this into if [ ! -e ~/mysock ]; then
eval $(ssh-agent -s -a ~/mysock)
ssh-add ~/id_rsa
else
echo SSH agent already running
export SSH_AUTH_SOCK=~/mysock
fi What this does is, if the socket does not exist (first run of the session), it starts That (P.S. I'm eagerly awaiting WSL2 myself. 😄 It's a huge improvement over the local VM that Windows does today, particularly in performance.) |
You gonna kill me now... I am not sure if it worth to continue persuading that SSH_AUTH_SOCK option is needed or just give up and keep doing some workarounds. |
Also, I am not sure (hontstly, have not tested yet) whether VS Code Server runs any bash profile files upon startup. It is quite possible it may skip it overall |
It did run Still, I see your point about this not being clean, since it would affect the whole environment. I will keep this issue open for now. I imagine it's not a common case to mix three environments (the Windows host + WSL + remote SSH Docker daemon) but you aren't the first to try it, so we will keep it in mind. 😄 In the meantime, I did find this guide on how to make a script run specifically for the VSCode remote session, rather than for everything (i.e. in Strangely though, my experience of it running
|
|
@bwateratmsft Sorry, I am following the steps here, but when I wanted to "Open in Browser", I got "No valid ports were mapped from the container to the host." Do you know how to solve it? |
Can you inspect the container and share the output? |
Your container does not have any ports published. How did you start it? |
|
Can you share the full command line of your |
|
I added |
|
Ah, gotcha. The Docker extension doesn't have a file browser for containers. The Remote - Containers can sorta do it, if you attach VSCode to the container, and do "Open Folder", you can see things. Honestly the easiest way is to attach a shell to the container and use the command line to explore. |
Thanks, because my development environment is in a container : ) |
@steverice we've been looking at a way to do bring-your-own-Dockerode-settings to enable users to have complete control over what Dockerode does. I see that line you linked where the options are passed into Is the need strong enough to make an issue/PR in |
@bwateratmsft I'm not exactly sure 😁 This seems to work okay after playing with some settings (and using
I came across this issue because it seems to deal with the (this is also why the line you linked wouldn't be an issue for me, as it only overrides the |
It overrides the |
@bwateratmsft my understanding is |
@karolz-ms I think you're missing the same thing I did, which is that the options we care about are in the call to I've opened apocas/docker-modem#118, let's see how that does. |
That's correct, but the |
Roger, thanks guys |
I've added a new setting, |
The fix is now available in version 1.2.0 of the Docker extension. |
vscode-docker/src/utils/refreshDockerode.ts
Line 63 in 836a765
vscode-docker/src/utils/refreshDockerode.ts
Line 81 in 836a765
I doubt setting of
SSH_AUTH_SOCK
variable is necessary. I keep it undefined, but haveIdentityAgent
,IdentityFile
,AddKeysToAgent
in my.ssh/config
. However the code referenced at the top makes my configuration unusable for this extension, while it perfectly works everywhere else outside vscode-docker.Can this check be removed or replaced with something else? There are other options for SSH to avoid interactive password prompt, such as
BatchMode
orIdentitiesOnly
.Thank you!
The text was updated successfully, but these errors were encountered: