我注意到从ws2016 imgae microsoft/windowsservercore:latest
到ws2019图像mcr.microsoft.com/windows/servercore:ltsc2019
的路径处理行为发生了变化。
在microsoft/windowsservercore:latest
图像上,以下所有命令均有效。
但是对于mcr.microsoft.com/windows/servercore:ltsc2019
映像,需要将入口点设置为绝对路径,以便能够在Docker容器内调用可执行文件。或将入口点设置为powershell
。
有人知道在处理可执行路径时microsoft/windowsservercore:latest
和mcr.microsoft.com/windows/servercore:ltsc2019
图像之间有什么变化吗?
复制步骤:
先决条件:找到任何可执行文件并将其命名为test.exe
Dockerfile
FROM mcr.microsoft.com/windows/servercore:ltsc2019
ADD test.exe test.exe
以test-image
运行该图像
工作命令
docker run --entrypoint powershell test-image "C:\test.exe"
docker run --entrypoint C:\test.exe test-image
docker run test-image "C:\test.exe"
不起作用的命令(但是,它们都在microsoft/windowsservercore:latest
图片上起作用)
docker run --entrypoint ./test.exe test-image
docker run test-image "./test.exe"
# error message
C:\Program Files\Docker\docker.exe: Error response from daemon: container ff8cff9dbd233a2f0ab3764203da42c47249b66a84b8369643315f2e210f86c6 encountered an error during CreateProcess: failure in a Windows system call: The system cannot find the file specified. (0x2) extra info: {"CommandLine":".\test.exe ","WorkingDirectory":"C:\\","CreateStdInPipe":true,"CreateStdOutPipe":true,"CreateStdErrPipe":true,"ConsoleSize":[0,0]}.