Failed to connect. Is Docker installed?
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 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...
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.
Are there any settings in place that would change the environment variables (in particular PATH) for VSCode?
Not that I know of... its an out of the box install with the PowerShell, and terraform extensions installed.
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.
@derekschauland sorry for the delay in reply, been busy with a bunch of things. Can you do a few checks for me?
- In the terminal, run
docker -vand let me know the output. - In the terminal, run
which docker, to see where it's picking Docker up from. I think it's/usr/local/bin/dockerby default on Mac. - Next, can you run
$ENV:PATHto get thePATHvariable from the VSCode terminal? I expect it should include/usr/local/binor whatever containsdocker, from step 1 above. You can censor unrelated things, mainly I'm just interested to see what it has pertaining to the Docker path. - 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.
- Open the command palette, and run "Developer: Toggle Developer Tools" (not "Open Webview Developer Tools")
- In the dev tools window, go to the Sources tab, then to the Watch pane.
- Put
process.env.PATHin as a watch variable. It should pick up the value, which you can copy and paste out.
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 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 🙄
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!