Docker Windows 2019映像入口点怪异路径问题

时间:2019-04-30 00:20:08

标签: windows docker containers docker-windows

我注意到从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:latestmcr.microsoft.com/windows/servercore:ltsc2019图像之间有什么变化吗?

复制步骤:

先决条件:找到任何可执行文件并将其命名为test.exe

Dockerfile

FROM mcr.microsoft.com/windows/servercore:ltsc2019
ADD test.exe test.exe

test-image

的形式构建此Dockerfile。

运行该图像

工作命令

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]}.

0 个答案:

没有答案