-
Notifications
You must be signed in to change notification settings - Fork 1.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
buildkit WCOW cannot seemingly run RUN powershell ...
, while vanilla dockerd can
#4901
Comments
To provide a bit more context: The following works: FROM mcr.microsoft.com/windows/servercore:ltsc2022
RUN C:/Windows/System32/WindowsPowerShell/v1.0/powershell.exe write-host Hello
# Outputs: Hello While this doesn't: FROM mcr.microsoft.com/windows/servercore:ltsc2022
RUN powershell.exe write-host Hello
# Error: 'powershell.exe' is not recognized as an internal or external command,
# operable program or batch file. Seems that it doesn't load the nerdctl.exe run --rm -it mcr.microsoft.com/windows/servercore:ltsc2022 powershell hello
# Outputs: hello Additionally, buildkit seems to persist the PATH issue to the generated image: # Default servercore
nerdctl run --rm mcr.microsoft.com/windows/servercore:ltsc2022 cmd /c echo %PATH%
# C:\Windows\system32;C:\Windows;C:\Windows\System32\Wbem;C:\Windows\System32\WindowsPowerShell\v1.0\;C:\Windows\System32\OpenSSH\;C:\Users\ContainerAdministrator\AppData\Local\Microsoft\WindowsApps
# image built with buildkit based on servercore
nerdctl run --rm -it my-buildkit-image:latest cmd /c echo %PATH%
# c:\Windows\System32;c:\Windows Versions: |
Sure, we're picking up this discussion from #3158 // For the time-being, a work-around will be adding this at the beginning: SHELL ["C:\\Windows\\System32\\WindowsPowerShell\\v1.0\\powershell"] |
/cc. @danielGithinji |
Another workaround that should help solve this issue is by changing the PATH environment variable. This can be done by using the ENV dockerfile command i.e:
By using docker you can also grab the container path and use the ENV command to modify the path in your dockerfile as shown above. That way any executable in the path will be accessible. A docker command to grab the path is as follows:
|
Dockerfile:
This errors with "is not a command" on buildkit / containerd (latest), runs fine in dockerd.
The text was updated successfully, but these errors were encountered: