title: Restart Docker container during build process
body: <p>I need to restart the Docker container during the build process due <code>dotnetfx</code>. <code>Dockerfile</code>:</p>
  
  <pre><code>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
  </code></pre>
  
  <p>But I'm facing this error:</p>
  
  <pre><code>Packages requiring reboot:
   - dotnetfx (exit code 3010) # &lt;--- it means a reboot is needed!
  </code></pre>
  
  <p>I tried to run both commands in the same <code>RUN</code> and adding <code>Restart-Computer</code> between them (separte by <code>\</code>) and executing a <code>RUN</code> command after each installation command either but when I do it looks like Docker output get lost.</p>
  
  <p>Can I restart the current container during the build process without make Docker get lost and keep the installation process?</p>
  
  <hr>
  
  <p><strong>UPDATE 1</strong></p>
  
  <p>Tried to install this <code>dotnetfx</code> before run the last command but I get the same error.</p>
  
  <pre><code># Microsoft .NET Framework (https://chocolatey.org/packages/dotnetfx)
  RUN choco install dotnetfx --confirm
  </code></pre>
  
  <p>Error:</p>
  
  <pre><code>Packages requiring reboot:
   - dotnetfx (exit code 3010)
  </code></pre>
  
  <hr>
  
  <p><strong>UPDATE 2 (WORKAROUND)</strong></p>
  
  <p>I've manage to workaround this problem using a base image with .NET already installed:</p>
  
  <pre><code>FROM mcr.microsoft.com/dotnet/framework/sdk:4.8
  </code></pre>