microsoft / vscode-docker

Docker Extension for Visual Studio Code
https://marketplace.visualstudio.com/items?itemName=ms-azuretools.vscode-docker
Other
1.18k stars 508 forks source link

'C:\Program' is not recognized as an internal or external command, operable program or batch file. #4212

Closed mdhvg closed 4 months ago

mdhvg commented 5 months ago

Does this occur consistently? Yes Repro steps:

  1. Run any docker container.
  2. Open the docker tab from Side Bar image
  3. Right click on any running container.
  4. Select either View Logs or Attach Shell image

Error: image

Since I have installed docker in the default install location, C:\Program Files\Docker\Docker\resources\bin\docker.exe the space in Program Files is causing the issue.

The error also occurs when trying to run some npm build commands from the JS debugger

Version: 1.28.0 OS: win32 OS Release: 10.0.19045 Product: Visual Studio Code Product Version: 1.85.2 Language: en

bwateratmsft commented 5 months ago

Do you have a value set for the VSCode setting docker.dockerPath?

mdhvg commented 5 months ago

Do you have a value set for the VSCode setting docker.dockerPath?

I tried setting it to the same value as in the PATH environment variable, but that caused image

I tried both paths: "C:\Program Files\Docker\Docker\resources\bin\docker.exe" "C:\Program Files\Docker\Docker\resources\bin"

bwateratmsft commented 5 months ago

Try resetting the setting to have no value, does the issue still reproduce?

mdhvg commented 5 months ago

Try resetting the setting to have no value, does the issue still reproduce?

VS code is able to find docker but, the original issue still reproduces.

bwateratmsft commented 5 months ago

It looks like you're using cmd as your shell, does it still happen if you use PowerShell as your shell instead? The relevant setting is terminal.integrated.defaultProfile.windows I believe. This may work as a workaround.

cmd is supported so this should be working, there might be a bug in VSCode because it's supposed to be handling the shell quoting for us in the case of task execution which is what's happening here.

mdhvg commented 5 months ago

It looks like you're using cmd as your shell, does it still happen if you use PowerShell as your shell instead? The relevant setting is terminal.integrated.defaultProfile.windows I believe. This may work as a workaround.

cmd is supported so this should be working, there might be a bug in VSCode because it's supposed to be handling the shell quoting for us in the case of task execution which is what's happening here.

Whoa! It worked with PowerShell as default shell.

bwateratmsft commented 4 months ago

I'm not able to reproduce in VSCode 1.86.1, can you check if this still repros for you in the latest VSCode?

AzCode-Bot commented 4 months ago

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!