I need to restart the Docker container during the build process due dotnetfx
. Dockerfile
:
FROM mcr.microsoft.com/windows/servercore:ltsc2019
SHELL ["powershell", "-Command", "$ErrorActionPreference = 'Stop'; $ProgressPreference = 'SilentlyContinue';"]
# Install Chocolatey
RUN Set-ExecutionPolicy Bypass -Scope Process -Force; [System.Net.ServicePointManager]::SecurityProtocol = [System.Net.ServicePointManager]::SecurityProtocol -bor 3072; iex ((New-Object System.Net.WebClient).DownloadString('https://chocolatey.org/install.ps1'))
# Universal Windows Platform build tools workload for Visual Studio 2019 Build Tools (https://chocolatey.org/packages/visualstudio2019-workload-universalbuildtools#dependencies)
RUN choco install visualstudio2019-workload-universalbuildtools --package-parameters "--includeOptional" --confirm
But I'm facing this error:
Packages requiring reboot:
- dotnetfx (exit code 3010) # <--- it means a reboot is needed!
I tried to run both commands in the same RUN
and adding Restart-Computer
between them (separte by \
) and executing a RUN
command after each installation command either but when I do it looks like Docker output get lost.
Can I restart the current container during the build process without make Docker get lost and keep the installation process?
UPDATE 1
Tried to install this dotnetfx
before run the last command but I get the same error.
# Microsoft .NET Framework (https://chocolatey.org/packages/dotnetfx)
RUN choco install dotnetfx --confirm
Error:
Packages requiring reboot:
- dotnetfx (exit code 3010)
UPDATE 2 (WORKAROUND)
I've manage to workaround this problem using a base image with .NET already installed:
FROM mcr.microsoft.com/dotnet/framework/sdk:4.8