Search code examples
dockerwindows-server-2016visual-studio-2017-build-tools

VS BuildTools won't install in docker container on windows server 2016


I was following this guide with a single modification: instead of ltsc2019 I used ltsc2016 because on windows server 2016 you can't have ltsc2019.

Everything went fine up to the RUN stage: the installer produces some output and then abruptly (the last output line is truncated halfway) stops doing anything.

Sample output:

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_

Solution

  • This is because you are running of drive space on C drive which is 20GB inside container. Unfortunately build does not support to specify storage-opt so I don't beleive currently a solution for this. Refer to this still open ticket (https://github.com/moby/moby/issues/34947)