我仅对guide进行了一次修改:我使用ltsc2016而不是ltsc2019,因为在Windows Server 2016上您不能拥有ltsc2019。

一切顺利,直到RUN阶段:安装程序产生一些输出,然后突然(最后一条输出线被截断了一半)停止执行任何操作。

样本输出:

PS> docker build -t buildtools2019:latest -m 2GB .
Sending build context to Docker daemon  1.291MB
Step 1/6 : FROM mcr.microsoft.com/dotnet/framework/sdk:4.8-windowsservercore-ltsc2016
 ---> 60b66cbb41a3
Step 2/6 : SHELL cmd /S /C
 ---> Using cache
 ---> fd7a0b7ae860
Step 3/6 : ADD https://aka.ms/vs/16/release/vs_buildtools.exe C:\TEMP\vs_buildtools.exe
Downloading [==================================================>]   1.34MB/1.34MB

 ---> Using cache
 ---> 91ea2d1b1299
Step 4/6 : RUN C:\TEMP\vs_buildtools.exe --quiet --wait --norestart --nocache     --installPath C:\BuildTools     --all     --remove Microsoft.VisualStudio.Component.Windows10SDK.10240     --remove Microsoft.VisualStudio.Component.Windows10SDK.10586     --remove Microsoft.VisualStudio.Component.Windows10SDK.14393     --remove Microsoft.VisualStudio.Component.Windows81SDK  || IF "%ERRORLEVEL%"=="3010" EXIT 0
 ---> Running in 2f63ab89f5db
Preparing: C:\Users\ContainerAdministrator\AppData\Local\Temp\fbc497b0c200d3c7418623ae\vs_bootstrapper_d15\HelpFile\1028\help.html...
Preparing: C:\Users\ContainerAdministrator\AppData\Local\Temp\fbc497b0c200d3c7418623ae\vs_bootstrapper_d15\HelpFile\2052\help.html...
Preparing: C:\Users\ContainerAdministrator\AppData\Local\Temp\fbc497b0c200d3c7418623ae\vs_bootstrapper_d15\HelpFile\1029\help.html...
Preparing: C:\Users\ContainerAdministrator\AppData\Local\Temp\fbc497b0c200d3c7418623ae\vs_bootstrapper_d15\HelpFile\1031\help.html...
Preparing: C:\Users\ContainerAdministrator\AppData\Local\Temp\fbc497b0c200d3c7418623ae\vs_bootstrapper_d15\HelpFile\1055\help.html...
Preparing: C:\Users\ContainerAdministrator\AppData\Local\Temp\fbc497b0c200d3c7418623ae\vs_bootstrapper_d15\HelpFile\1046\help.html...
Preparing: C:\Users\ContainerAdministrator\AppData\Local\Temp\fbc497b0c200d3c7418623ae\vs_bootstrapper_d15\HelpFile\1042\help.html...
Preparing: C:\Users\ContainerAdministrator\AppData\Local\Temp\fbc497b0c200d3c7418623ae\vs_bootstrapper_d15\HelpFile\1036\help.html...
Preparing: C:\Users\ContainerAdministrator\AppData\Local\Temp\fbc497b0c200d3c7418623ae\vs_bootstrapper_d15\HelpFile\3082\help.html...
Preparing: C:\Users\ContainerAdministrator\AppData\Local\Temp\fbc497b0c200d3c7418623ae\vs_bootstrapper_d15\HelpFile\1040\help.html...
Preparing: C:\Users\ContainerAdministrator\AppData\Local\Temp\fbc497b0c200d3c7418623ae\vs_bootstrapper_d15\HelpFile\1045\help.html...
Preparing: C:\Users\ContainerAdministrator\AppData\Local\Temp\fbc497b0c200d3c7418623ae\vs_bootstrapper_d15\HelpFile\1041\help.html...
Preparing: C:\Users\ContainerAdministrator\AppData\Local\Temp\fbc497b0c200d3c7418623ae\vs_bootstrapper_d15\HelpFile\1049\help.html...
Preparing: C:\Users\ContainerAdministrator\AppData\Local\Temp\fbc497b0c200d3c7418623ae\vs_bootstrapper_d15\HelpFile\1033\help.html...
Preparing: C:\Users\ContainerAdministrator\AppData\Local\Temp\fbc497b0c200d3c7418623ae\vs_bootstrapper_d15\vs_setup_bootstrapper.exe...
Preparing: C:\Users\ContainerAdministrator\AppData\Local\Temp\fbc497b0c200d3c7418623ae\vs_bootstrapper_d15\Microsoft.Diagnostics.Tracing.EventSource.dll...
Preparing: C:\Users\ContainerAdministrator\AppData\Local\Temp\fbc497b0c200d3c7418623ae\vs_bootstrapper_d15\Microsoft.VisualStudio.RemoteControl.dll...
Preparing: C:\Users\ContainerAdministrator\AppData\Local\Temp\fbc497b0c200d3c7418623ae\vs_bootstrapper_d15\Microsoft.VisualStudio.Setup.Common.dll...
Preparing: C:\Users\ContainerAdministrator\AppData\Local\Temp\fbc497b0c200d3c7418623ae\vs_bootstrapper_d15\Microsoft.VisualStudio.Setup.dll...
Preparing: C:\Users\ContainerAdministrator\AppData\Local\Temp\fbc497b0c200d3c7418623ae\vs_bootstrapper_d15\Microsoft.VisualStudio.Setup.Download.dll...
Preparing: C:\Users\ContainerAdministrator\AppData\Local\Temp\fbc497b0c200d3c7418623ae\vs_bootstrapper_d15\Microsoft.VisualStudio.Telemetry.dll...
Preparing: C:\Users\ContainerAdministrator\AppData\Local\Temp\fbc497b0c200d3c7418623ae\vs_bootstrapper_d15\Microsoft.VisualStudio.Utilities.Internal.dll...
Preparing: C:\Users\ContainerAdministrator\AppData\Local\Temp\fbc497b0c200d3c7418623ae\vs_bootstrapper_d15\Newtonsoft.Json.dll...
Preparing: C:\Users\ContainerAdministrator\AppData\Local\Temp\fbc497b0c200d3c7418623ae\vs_bootstrapper_d15\zh-Hans\vs_setup_bootstrapper.resources.dll...
Preparing: C:\Users\ContainerAdministrator\AppData\Local\Temp\fbc497b0c200d3c7418623ae\vs_bootstrapper_d15\zh-Hant\vs_setup_bootstrapper.resources.dll...
Preparing: C:\Users\ContainerAdministrator\AppData\Local\Temp\fbc497b0c200d3c7418623ae\vs_bootstrapper_d15\tr\vs_setup_bootstrapper.resources.dll...
Preparing: C:\Users\ContainerAdministrator\AppData\Local\Temp\fbc497b0c200d3c7418623ae\vs_bootstrapper_d15\pt-BR\vs_setup_bootstrapper.resources.dll...
Preparing: C:\Users\ContainerAdministrator\AppData\Local\Temp\fbc497b0c200d3c7418623ae\vs_bootstrapper_d15\cs\vs_setup_bootstrapper.resources.dll...
Preparing: C:\Users\ContainerAdministrator\AppData\Local\Temp\fbc497b0c200d3c7418623ae\vs_bootstrapper_d15\es\vs_

最佳答案

这是因为您正在容器内部20GB的C驱动器上运行驱动器空间。不幸的是build不支持指定storage-opt,因此我目前不相信此解决方案。参考此仍未解决的票证(https://github.com/moby/moby/issues/34947)

09-04 10:36