Vscode-docker: docker exe missing from path issue (MacOS) (again)

Created on 23 Apr 2021  路  26Comments  路  Source: microsoft/vscode-docker

Description:
Docker executable cannot be found. It throws following error:

exec: "com.docker.cli": executable file not found in $PATH

This problem was previously reported and fixed. It worked for me without any problems for a few weeks. Now it is broken again (at least for me).

Previous Discussion:
https://github.com/microsoft/vscode-docker/issues/2578

Discussion on Docker:
https://github.com/docker/compose-cli/issues/754

Discussion of possible fixed on Stackoverflow:
https://stackoverflow.com/questions/64120020/exec-com-docker-cli-executable-file-not-found-in-path


What I tried so far to fix it again:

  • reinstall docker and cli
  • reinstall vscode-docker
  • (rebooting)

Versions:

vscode-Docker: 1.12.1
Docker Engie: 20.10.5
Docker Desktop: 3.3.1
macOS Big Sur, 11.2.3 (Intel)

My results from PATH Checking:

PATHS

Cheers
Hannes

Most helpful comment

The problem also exists with git Bash:
"com.docker.cli": executable file not found in %PATH%
On Windows Power Shell it works fine.

All 26 comments

@HannesOberreiter sorry to hear that. Did you try disabling "cloud experience" in Docker Desktop, as described by https://github.com/docker/compose-cli/issues/754#issuecomment-724809235. ?

@karolz-ms the option was removed I think with version 3.2.x.

Cheers
Hannes

I see. Hmm. Bummer.

Could you do us a favor and do the following troubleshooting:

  1. Try to reproduce the issue. Do not close the VS Code terminal that reports Docker exe not found error.
  2. Find the PID of the terminal process that reported the error (it will be one of the VS Code processes that has --type=ptyHost argument applied)
  3. Do ps eww <PID> on that process and report if the PATH environment variable contains /usr/local/bin.

Thank you!

@karolz-ms sure.

It is included in the PATH env.

image

I can confirm to have the same issue, both on macOS Big Sur on Intel chip and on macOS Big Sur on Apple chip.

Maybe it is possible to disable "cloud experience" from terminal?

@HannesOberreiter @LeaveMyYard thank you Could you also please share the exact repro steps so we can be sure we are all looking at the same codepath?

@HannesOberreiter thank you, yes, that is very clear

I have found several VS Code issues that look similar, although do not involve Docker https://github.com/microsoft/vscode/issues/107169 https://github.com/microsoft/vscode/issues/108003 https://github.com/OmniSharp/omnisharp-vscode/issues/4037 Someone mentioned that Developer: reload window gesture seems to fix at least some extension. Can you try and report whether that is a good workaround?

@karolz-ms, thanks for your research. The mentioned Developer: reload window did not help. Opening VSCode from Application and not via Terminal did also not help.

I stumbled across this issue by accident. I can add to this discussion that this problem also exists in IntelliJ on MacOS Big Sur (Intel) with Docker Desktop since version 3.3.1. So maybe this is a Docker CLI issue and not vscode related?

@HannesOberreiter @LeaveMyYard thank you Could you also please share the exact repro steps so we can be sure we are all looking at the same codepath?

Also, docker-compose is working fine (except starting containers, because at some points it seems to run a docker command, that ends up in an error). Hope it will help.

https://user-images.githubusercontent.com/33721692/116240716-cea29480-a76c-11eb-84f5-3006bd28ce62.mov

Thank you @RobYed and @LeaveMyYard

I am pretty sure this is not a VS Code Docker extension issue, and the fact that disabling "cloud experience" in Docker Desktop used to be a viable workaround makes me think it is not a VS Code core issue either. Unfortunately the workaround we added earlier this year https://github.com/microsoft/vscode-docker/pull/2619 does not seem to help

I have pinged my buddies at Docker, will see what they say. We might need to consider some other workarounds in our code as proposed in https://github.com/microsoft/vscode-docker/issues/2578 ...

The problem also exists with git Bash:
"com.docker.cli": executable file not found in %PATH%
On Windows Power Shell it works fine.

The problem also exists with git Bash:
"com.docker.cli": executable file not found in %PATH%
On Windows Power Shell it works fine.

I also faced the same issue on some other machine, where I can run the docker command on windows cmd or PowerShell,
but not on git bash.
But I found that we can run the docker commands with com.docker.cli on git bash.. it is working.. for example
docker ps was giving me an error while com.docker.cli ps was running fine on git bash...
Surprisingly, I am running the same docker-desktop version but I am not facing that issue... but some on some other machine I faced.

I am facing similar situation as well. When I try to attach to docker shell through vscode, I get the following error message

Executing task: docker exec -it docker_hash bash <

exec: "com.docker.cli": executable file not found in $PATH
The terminal process "/bin/zsh '-c', 'docker exec -it docker_hash bash'" terminated with exit code: 1.

+1 on this issue.

Same issue when trying to run the docker image from VSCode.

Executing task: docker run --rm -d -p 8000:8000/tcp dockervscode:latest <

exec: "com.docker.cli": executable file not found in $PATH
The terminal process "/bin/zsh '-c', 'docker run --rm -d -p 8000:8000/tcp dockervscode:latest'" terminated with exit code: 1.

Terminal will be reused by tasks, press any key to close it.

same issue here

The workaround for me is to use the Mac Terminal instead of the integrated terminal in VS Code.

macOS Big Sur version 11.4, Intel
docker desktop version 3.3.3 (64133)
VS Code Version: 1.56.2

I am planning to add a setting (docker.dockerPath) that will allow one to specify where exactly VS Code should look for Docker CLI executable. It is a workaround, but hopefully one that is not too cumbersome. If anyone has thoughts on this, please share!

I would be fine with this "workaround" as I also need to set the locations for other extensions in VSCode (e.g R and LaTeX). That means for Docker I would simply set the bin location, for example in my case /usr/local/bin/Docker

Just curious if you were able to test if the workaround does work? As the error message indicates that the docker command is found but not the connection to com.docker.cli? Which seems strange for me on the first glance, but I also don't understand how everything works, so it could be nothing.

Cheers
Hannes

Hi Hannes, we have implemented similar workarounds for other VS Code extensions that my team owns (e.g. Dapr), so I am quite certain it will work for this extension too.

@karolz-ms for me and another user (https://github.com/docker/compose-cli/issues/754#issuecomment-860549027) the issue seems to be fixed with the newest VSCode update.

It could have something to do with following fix (but thats only a rough guess)? https://github.com/microsoft/vscode/issues/108804

Version: 1.57.0
Commit: b4c1bd0a9b03c749ea011b06c6d2676c8091a70c
Date: 2021-06-09T17:22:31.215Z (4 days ago)
Electron: 12.0.9
Chrome: 89.0.4389.128
Node.js: 14.16.0
V8: 8.9.255.25-electron.0
OS: Darwin x64 20.3.0

Cheers
Hannes

@HannesOberreiter possibly. Thanks for letting us know. We will keep the "Docker CLI path" setting just in case.

Workaround has shipped in 1.14 release

@karolz-ms thanks a lot for your work!

Was this page helpful?
0 / 5 - 0 ratings