microsoft/Windows-Containers

buildkit/buildx: powershell not in the PATH, error: The system cannot find the file specified.: unknown

lisanna-dettwyler opened this issue · 5 comments

Describe the bug
Screenshot 2024-05-21 130740
Building a simple powershell example is failing with docker buildx build using the new buildkit support for windows containers.

The system cannot find the file specified.: unknown

To Reproduce
https://github.com/lisanna-dettwyler/win-buildx-error/blob/master/.github/workflows/build.yml

Setup steps for the GitHub runner taken from #34 (comment)

Expected behavior
The step should succeed as it does in the companion job built without buildkit: https://github.com/lisanna-dettwyler/win-buildx-error/actions/runs/9178335051/job/25237996047

Configuration:

  • Edition: Windows Server 2022 (windows-latest tag in GitHub Actions)
  • Base Image being used: mcr.microsoft.com/dotnet/framework/runtime:4.8
  • Container engine: containerd
  • Container Engine version: 1.7.15

Additional context
https://github.com/lisanna-dettwyler/win-buildx-error

For your Dockerfile, can you provide the absolute path to PowerShell instead and let me know what you get?

SHELL ["C:\\Windows\\System32\\WindowsPowerShell\\v1.0\\powershell"]

It seems to resolve that problem, and I get a new problem: https://github.com/lisanna-dettwyler/win-buildx-error/actions/runs/9228065502/job/25391331731

image

The remote name could not be resolved

That should probably have its own issue.

Cross-linking to moby/buildkit#4901 -- for the original issue.

However, on this second one, I doubt has anything to do with buildkit but perhaps just the DNS resolution issues on the runner...
Try using the expanded url: 'https://download.visualstudio.microsoft.com/download/pr/81bda3f8-b6f6-4caa-afe1-bfaaecb5ceb7/b792b2f59962c4f8765fbc9e2ccc10e1d7bc9e776fb6795ceaf6038e82a8bb1c/vs_BuildTools.exe

Got it from curl.exe -I -L -v https://aka.ms/vs/16/release/vs_buildtools.exe

@lisanna-dettwyler -- confirming that the name resolution issue is happening across, investigating here - moby/buildkit#4960

@lisanna-dettwyler -- documentation fix now done, please check moby/buildkit#4978

I'll close this one in favour of moby/buildkit#4901 // let me know if that's ok. Feel free to re-open.