我正在尝试设置一个nanoserver容器,以便运行在Visual Studio 2017中使用/ MD标志构建的C ++可执行文件。
我知道我需要为Visual Studio 2017安装Microsoft Visual C ++ Redistributable。
我设法创建了容器,下载了可再发行组件并将其添加到根目录下的容器中。但是,从Dockerfile构建时,出现以下错误消息:
Exception(2) tid(360) 80070002 The system cannot find the file specified.
CallContext:[\Bridge_ProcessMessage\ComputeSystemManager_ExecuteProcess\VmHostedContainer_ExecuteProcess]
Provider: 00000000-0000-0000-0000-000000000000] extra info: {"CommandLine":"powershell -Command $ErrorActionPreference = 'Stop'; $ProgressPreference = 'SilentlyContinue'; $verbosePreference='Continue'; Start-Process -filepath c:\\vc_redist.exe -ArgumentList \"/install\", \"/passive\", \"/norestart\", \"'/log a.txt'\" -PassThru | wait-process","User":"ContainerUser","WorkingDirectory":"C:\\","Environment":{"PSCORE":"C:\\Program Files\\PowerShell\\pwsh.exe","ProgramFiles":"C:\\Program Files","VS2017":"https://aka.ms/vs/16/release/vc_redist.x64.exe"},"CreateStdInPipe":true,"CreateStdOutPipe":true,"CreateStdErrPipe":true,"ConsoleSize":[0,0]}
这是我的Dockerfile:
ARG FROM_IMAGE=microsoft/powershell:6.0.0-beta.9-nanoserver-1709
FROM ${FROM_IMAGE}
SHELL ["powershell", "-Command", "$ErrorActionPreference = 'Stop'; $ProgressPreference = 'SilentlyContinue'; $verbosePreference='Continue';"]
ARG VS2017=https://aka.ms/vs/16/release/vc_redist.x64.exe
ADD ${VS2017} /vc_redist.exe
RUN Start-Process -filepath c:\vc_redist.exe -ArgumentList "/install", "/passive", "/norestart", "'/log a.txt'" -PassThru | wait-process
我尝试从dockerfile中删除最后一行,并在构建后在容器中运行它,但我根本没有任何输出。
还希望避免使用Windows Server Core,因为我们试图将尺寸保持尽可能小。
任何帮助都将不胜感激。