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 host #216

Closed
voney opened this issue Feb 19, 2018 · 16 comments · Fixed by #998
Closed

Connect to remote docker host #216

voney opened this issue Feb 19, 2018 · 16 comments · Fixed by #998
Labels
Milestone

Comments

@voney
Copy link

voney commented Feb 19, 2018

Currently it's possible to override the default behavior of this extension by following the steps here: https://www.axians-infoma.de/navblog/use-vs-code-docker-extension-remote-docker-host/

Which end up setting the DOCKER_HOST environment variable.

Instead can we have a setting that does the same? Allowing different docker hosts to be used depending on the workspace?

@chrisdias
Copy link
Member

There are two challenges here.

First, the extension uses a mix of dockerode and the docker CLI. For example, it uses dockerode to enumerate images, containers, etc. for the Explorer. It also uses dockerode for commands like system prune and starting/stopping containers. The docker CLI is used whenever a terminal is spun up, for example when running a build. These APIs/CLIs look for the environment variable DOCKER_HOST, they do not have APIs for setting value directly. So, I would need to use something like dotenv for the dockerode APIs and then pass the DOCKER_HOST environment variable when creating new terminal instances. Do-able, but kind of messy.

The second problem is when you have multiple root workspaces open. Which .env file do I use and how does the user know? I would have to have a setting that would point to the appropriate .env file to use when the workspace is opened and if none exists then what is the behavior?

@chrisdias
Copy link
Member

actually, I can't seem to get dotenv to load before dockerode...

@kneidem
Copy link

kneidem commented May 27, 2018

I'm sharing the same problem but the first challenge seems solvable for me: The dockerode API provides an overloaded constructor for such cases, and the docker CLI can be covered by injecting the environment variable with TerminalOptions when creating a new integrated terminal instance. Thus, each CLI/API call can address an individual docker host. Or have I missed some limitations?

@rustyx
Copy link

rustyx commented Jul 3, 2018

Please implement this! I need to switch between local and remote Docker environment without restarting VSCode.

Note that it's not just DOCKER_HOST, but also DOCKER_MACHINE_NAME, DOCKER_TLS_VERIFY and DOCKER_CERT_PATH that need to be configurable.

@noaho
Copy link

noaho commented Feb 26, 2019

+1, I would love to be able to use different docker environments per workspace, change servers without reloading VSCode, and not have to run commands before starting VSCode to connect to a remote SSL machine.

@x13machine
Copy link

You can set this with the setting docker.host. Am I misunderstanding something?

@sureshsankaran
Copy link

sureshsankaran commented May 7, 2019

Lets say i want to connect to docker engine on remote linux server (with TLS=1) from my local mac via vscode, how do we do that today ? Just changing docker.host doesn't solve it. We need DOCKER_TLS, DOCKER_TLS_VERIFY support as well.

@SuperSandro2000
Copy link

It would be way easier if we could install the extension on the remote host via vscode remote preview.

@ejizba
Copy link
Contributor

ejizba commented Jun 17, 2019

Hi all - just merged #998 to support the following VS Code settings:

docker.host - equivalent to DOCKER_HOST
docker.certPath - equivalent to DOCKER_CERT_PATH
docker.tlsVerify - equivalent to DOCKER_TLS_VERIFY
docker.machineName - equivalent to DOCKER_MACHINE_NAME

Feel free to try the latest build from master and let us know if it works for ya! See these instructions: https://aka.ms/azCodeInsiders

@moortimis
Copy link

moortimis commented Jul 16, 2019

Hi there, I'm trying to enable the tlsVerify setting and have set the value to '0' and still not able to connect to registries using self signed certificates.

I'm running VSS: 1.36.1 and ms-azuretools.vscode-docker: 0.7.0 of this extension. Any idea when this will become generally available?

@ejizba
Copy link
Contributor

ejizba commented Jul 17, 2019

@moortimis moved your comment to a new issue. #1137

@sureshsankaran
Copy link

@EricJizbaMSFT In my production scenario, we are using these env variables
DOCKER_HOST
DOCKER_CERT_PATH
DOCKER_TLS and
DOCKER_API_VERSION

Could you please add these two new env variable support as well ?

@sureshsankaran
Copy link

Between i tried this alpha preview of docker extension. Looks like if we just set DOCKER_HOST, DOCKER_CERT_PATH (Not settting any value for "DOCKER_TLS_VERIFY" ), TLS_VERIFY automatically kicks in.

Ideally it will be great if the extension can support all the client modes mentioned in
https://docs.docker.com/engine/security/https/

Screen Shot 2019-07-26 at 8 25 18 PM

@sureshsankaran
Copy link

One more issue i observed that with docker extension explorer refresh, i see docker engine is leaking fd in every polling. With the default refresh interval of 1sec, i see docker engine pretty quickly hitting the soft limit of max open files and breaks down the engine. Before reporting to docker project, i would like to understand how this extension is querying the docker engine. Pls investigate. I am using docker engine version 18.03 and latest alpha version of this docker extension

@ejizba
Copy link
Contributor

ejizba commented Jul 29, 2019

@sureshsankaran you can change the default refresh interval with the VS Code setting docker.explorerRefreshInterval

Otherwise, please create a new issue for your other comments so that we can track it separately from this already closed bug

@sureshsankaran
Copy link

thanks opened below issues
1168
1169

@vscodebot vscodebot bot locked and limited conversation to collaborators Aug 5, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.