Skip to content
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

Connect to remote docker daemon when using "Remote - SSH" extension #924

Closed
pd93 opened this issue May 5, 2019 · 6 comments
Closed

Connect to remote docker daemon when using "Remote - SSH" extension #924

pd93 opened this issue May 5, 2019 · 6 comments
Labels
duplicate remote VS Code remote

Comments

@pd93
Copy link

pd93 commented May 5, 2019

The Remote - SSH extension

This week, the Remote Development pack was released to Insiders. This allows you to open up a VSCode window as if it were running on the remote host. I have been using the Remote - SSH extension to connect to a server and it works beautifully.

Expected vscode-docker behaviour

When I install the vscode-docker extension, it should be installed to the remote VSCode installation.
When opening a remote (SSH) vscode session, vscode-docker should list images/containers from the docker daemon on the remote host.

Actual vscode-docker behaviour

The extension is installed locally and lists my local containers/images.

Summary

It would be fantastic if these two extensions could work together so that I can view my remote docker container/images while I'm developing remotely over SSH and my local ones when working locally.

I don't think this effects the Remote - WSL and Remote - Containers extensions as developers tend to use the local Docker daemon in these environment anyway (either via opening TCP port 2375 or by using some form of DinD).

Potentially related to #216 & #646.

@PabloSzx
Copy link

PabloSzx commented May 7, 2019

This feature would be amazing, and the most strange behavior is that this extension is one of the few no-theme related extensions that installing on ssh is disabled, it only allows to install locally.

EDIT: https://code.visualstudio.com/docs/remote/containers#_advanced-forcing-an-extension-to-run-locally-remotely works, but the button "Attach Visual Studio Code" doesn't work

@aruiz14
Copy link

aruiz14 commented May 7, 2019

My expectations were also that it would use the docker socket in the remote, but it didn't work like that.

I managed to make it work with this workaround:

  • In your ~/.ssh/config, you can add to the section of the host you are connecting to the line (the actual port used is irrelevant, you can use a different one as long as it's not in use):
LocalForward 22375 /var/run/docker.sock
  • Then, while connected to the remote host, go to Settings, select the tab for the remote host and change the Docker Host config to localhost:22375.

You may need to reconnect to the host or restart VSCode for this to take effect.

@pd93
Copy link
Author

pd93 commented May 8, 2019

Done some further reading on this.

Firstly, this is addressed in the README which I hadn't noticed when I opened the issue. However, all it says about SSH is:

In SSH, the setup for docker is dependent on the machine environment.

I've also found the document about remote development for extension authors. It looks like adding:

"extensionKind": "workspace",

in the package.json file will force the extension to be recognised as a workspace (remote) extension. However, I can't confirm if this works or not because I can't get the extension to build over Remote SSH :')

@pd93
Copy link
Author

pd93 commented May 15, 2019

@PabloSzx's workaround fixes the problem for me on "Remote - SSH" sessions, but unfortunately it also breaks "Remote - WSL". (probably a separate issue). A slight improvement on this would be to force the docker extension to be installed on SSH sessions only:

    "remote.SSH.defaultExtensions": [
        "peterjausovec.vscode-docker"
    ]

But I can't get this to work either 😞

Unfortunately, this does mean my previous suggestion of setting "extensionKind" in the package.json might break the extension when running via "Remote - WSL" and "Remote - Container"?

@SuperSandro2000
Copy link

@pd93 it wouldn't matter if it does not work in remote wsl or docker cause you can't run docker on wsl or in a container. It only needs to function for remote ssh and then forward the data to the client vscode

@ejizba
Copy link
Contributor

ejizba commented May 23, 2019

@pd93 and others thanks for your comments on this! We've discussed this in the past and it's not a simple thing to pick the default behavior for the docker extension in VS Code remote scenarios. I'm going to close this issue in favor of #954 because this felt specific to SSH and I wanted a new issue that summarized our past discussions, your comments, the current workaround, etc. for all three scenarios (SSH, WSL, and Dev Containers). Feel free to add your opinion to the new issue!

@ejizba ejizba closed this as completed May 23, 2019
@ejizba ejizba added duplicate remote VS Code remote labels May 23, 2019
@vscodebot vscodebot bot locked and limited conversation to collaborators Jul 7, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
duplicate remote VS Code remote
Projects
None yet
Development

No branches or pull requests

5 participants