microsoft / vscode-remote-release

Visual Studio Code Remote Development: Open any folder in WSL, in a Docker container, or on a remote machine using SSH and take advantage of VS Code's full feature set.
https://aka.ms/vscode-remote
Other
3.62k stars 279 forks source link

Upgrading to 1.63 breaks attaching to Remote Containers over SSH if you have a custom docker executable path configured #6072

Open begillil opened 2 years ago

begillil commented 2 years ago

Steps to Reproduce:

  1. Configure remote.containers.dockerPath to a custom path, e.g. C:\Path\To\docker.exe
  2. Remote-SSH: Connect Current Window to Host and open a folder
  3. Attempt to run Remote-Containers: Attach to Running Container...

Expected: It shows a list of containers on the remote machine to attach to Actual: A prompt saying "Docker version 17.12.0 or later is required" (just to confirm, both the local docker.exe and the remote docker installation are both newer than version 17.12.0)

The same steps did work on version 1.62.

I saw that recently #2994 was completed and made available in version 1.63, which is awesome. I've wished it worked that way since I first tried to set up this kind of remote container over ssh configuration.

However, it seems when that change was introduced, nothing accounted for the fact that existing custom docker executable paths were not likely to be available on the remote machine. So it tries to execute docker from a path that doesn't exist on the remote machine and assumes docker must not be installed when that fails.

Also, I'll add that if you do follow the "Docker version required" prompt and install docker, it will install Docker Desktop locally, but the custom path is still configured, and still not available on the remote machine, so it will still fail the same way.

I was able to fix the problem for myself by setting remote.containers.dockerPath back to the default value of docker, but it took a bit of research to figure out that that was the problem in order to get to that point.

Chuxel commented 2 years ago

@chrmarti Is this setting respected if it's set as a machine setting on the Remote - SSH host? Certainly that would make sense.

486 commented 2 years ago

I am experiencing this even when the path is the default, i.e. docker. I downgraded to some arbitrary version v0.205.2 and now the issue is gone.

chrmarti commented 2 years ago

@486 Could you open a new issue with the log you get when this fails with the default setting? It sounds like that might be a different issue.

chrmarti commented 2 years ago

There is currently no way to make setting a 'machine setting' while connected with Remote-SSH and then a 'SSH server setting' while connected with Remote-Containers via that SSH server. VS Code settings are not aware of the SSH server in any way when we connect through the SSH server to the container.

We could make it a machine setting and read the SSH server's settings.json in Remote-Containers when connecting to the dev container, but then the setting would show up in the container's (and all other remotes) machine settings UI.

/cc @sandy081 for ideas.

sandy081 commented 2 years ago

@chrmarti Not sure if I understand the scenario. Can you please elaborate this more?

chrmarti commented 2 years ago

@sandy081 There is a setting to configure the Docker executable's path. That setting depends on the machine, so machine scope seems appropriate. However, when we connect to a container on an SSH server, that setting would be a machine setting on the SSH server, not the container. At that point the container is the remote and VS Code does not know about the SSH server.

sandy081 commented 2 years ago

I see, so the SSH server is not the VS Code Remote in this case? Instead the container in the SSH server is the remote? We have two remotes and we are not reading any settings from the first remote as it is not VS Code Remote. Since this is feature of remote containers, can remote containers read machine settings from SSH server?

chrmarti commented 2 years ago

Making it a machine setting would make it show up in the container's (and all other remotes) machine settings UI when we really only want it in the machine settings for Remote-SSH (and Remote-WSL). Maybe that's acceptable. 🤔

sandy081 commented 2 years ago

Yeah that seems good to me

ikivanc commented 2 years ago

I faced with similar issue:

VSCode Version: 1.63.2 Local OS Version: Windows 11 22000.434 Docker Version: Docker Desktop 4.4.4 (73704) Remote Extension/Connection Type: Open Folder in Container

yangm97 commented 1 year ago

Support for podman containers over ssh is broken too.