vscode-docker icon indicating copy to clipboard operation
vscode-docker copied to clipboard

Failed to connect. Is Docker installed?

Open derekschauland opened this issue 6 years ago • 9 comments

I have docker desktop for Mac installed and it runs fine from the command line. When I added the docker extension for VScode - the extension claimed docker was not found. It prompted for install - I replaced my installed version with the updated version even and the extension claims docker isn't installed.

From the terminal docker is running with no issues - also works from VSCode terminal. Not sure how to get extension to see installed and running docker engine.

derekschauland avatar Nov 20 '20 13:11 derekschauland

@derekschauland What shell do you have configured for VSCode to use? In order to detect if Docker is installed, we run docker -v on the default shell from Node's child_process, which is /bin/sh. I would expect that as long as docker -v works on /bin/sh, it should work...

bwateratmsft avatar Nov 20 '20 14:11 bwateratmsft

I am using pwsh as the default shell for vscode

From: Brandon Waterloo [MSFT] [email protected] Date: Friday, November 20, 2020 at 8:24 AM To: microsoft/vscode-docker [email protected] Cc: Derek Schauland [email protected], Mention [email protected] Subject: Re: [microsoft/vscode-docker] Failed to connect. Is Docker installed? (#2509)

@derekschaulandhttps://github.com/derekschauland What shell do you have configured for VSCode to use? In order to detect if Docker is installed, we run docker -v on the default shell from Node's child_processhttps://nodejs.org/api/child_process.html#child_process_child_process_spawn_command_args_options, which is /bin/sh. I would expect that as long as docker -v works on /bin/sh, it should work...

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHubhttps://github.com/microsoft/vscode-docker/issues/2509#issuecomment-731199905, or unsubscribehttps://github.com/notifications/unsubscribe-auth/AEWWFIJ5HU3MFHNZVTFM7HDSQZ32RANCNFSM4T4ZFOHA.

derekschauland avatar Nov 20 '20 14:11 derekschauland

Are there any settings in place that would change the environment variables (in particular PATH) for VSCode?

bwateratmsft avatar Nov 20 '20 17:11 bwateratmsft

Not that I know of... its an out of the box install with the PowerShell, and terraform extensions installed.

derekschauland avatar Nov 20 '20 18:11 derekschauland

I'm using Ubuntu and had to add myself as a user in a docker group to not have to run as sudo every time. At the end of doing that, I had to restart the group in the terminal with $ newgrp docker (Or completely log out and back into my session). I had to also run this command inside my VS Code terminal as well before the Docker extension would work. Don't know if this helps or not.

ZediWards avatar Nov 23 '20 03:11 ZediWards

@derekschauland sorry for the delay in reply, been busy with a bunch of things. Can you do a few checks for me?

  1. In the terminal, run docker -v and let me know the output.
  2. In the terminal, run which docker, to see where it's picking Docker up from. I think it's /usr/local/bin/docker by default on Mac.
  3. Next, can you run $ENV:PATH to get the PATH variable from the VSCode terminal? I expect it should include /usr/local/bin or whatever contains docker, from step 1 above. You can censor unrelated things, mainly I'm just interested to see what it has pertaining to the Docker path.
  4. Last, let's try to get the environment info from VSCode. I'd like to compare it to what we have from step 2 above. Again, you can censor unrelated things, really just care about the Docker path.
    1. Open the command palette, and run "Developer: Toggle Developer Tools" (not "Open Webview Developer Tools")
    2. In the dev tools window, go to the Sources tab, then to the Watch pane.
    3. Put process.env.PATH in as a watch variable. It should pick up the value, which you can copy and paste out. image

bwateratmsft avatar Dec 03 '20 17:12 bwateratmsft

The docker -v command simply produced the help menu

Dereks-MacBook-Pro:code-workspaces derek$ docker -v Usage: docker [flags] docker [command]

Available Commands: compose Docker Compose context Manage contexts ecs
exec Run a command in a running container help Help about any command inspect Inspect containers kill Kill one or more running containers login Log in to a Docker registry or cloud backend logout Log out from a Docker registry or cloud backend logs Fetch the logs of a container prune prune existing resources in current context ps List containers rm Remove containers run Run a container secret Manages secrets serve Start an api server start Start one or more stopped containers stop Stop one or more running containers version Show the Docker version information volume Manages volumes

Flags: --config DIRECTORY Location of the client config files DIRECTORY (default "/Users/derek/.docker") -c, --context string context -D, --debug Enable debug output in the logs -h, --help Help for docker -H, --host string Daemon socket(s) to connect to -v, --version Print version information and quit

Use "docker [command] --help" for more information about a command. Dereks-MacBook-Pro:code-workspaces derek$

which docker produced the following Dereks-MacBook-Pro:code-workspaces derek$ which docker /usr/local/bin/docker

The docker path above is missing from $ENV:PATH

The developer tools watch variable shows "/usr/bin:/bin:/usr/sbin:/sbin"

derekschauland avatar Dec 08 '20 12:12 derekschauland

@derekschauland I am afraid you are experiencing one of the issues related to incomplete path provided by OS X to the VS Code process, for example: https://github.com/microsoft/vscode-docker/issues/2254 https://github.com/docker/compose-cli/issues/754

Just this morning I got "Docker not installed" error when I launched VS Code from the Dock. I tried launching VS Code from terminal window and Docker extension started to work. Subsequent launches from Dock also work without changing anything. Go figure 🙄

karolz-ms avatar Dec 08 '20 17:12 karolz-ms

This issue has been closed automatically because it needs more information and has not had recent activity. See also our issue reporting guidelines.

Happy Coding!

vscodebot[bot] avatar Dec 29 '20 17:12 vscodebot[bot]