title: Docker build for Matlab Compiler Runtime on Windows (non-interactive installation)
body: <p>I notice that some steps in the Docker build takes more time than manually executing the same command in the container. To provide some context, the process of installing Matlab Compiler Runtime (MCR) is as follows:</p>
  
  <ol>
  <li>Download MCR installer from MathWorks website</li>
  <li>Unpack installation files</li>
  <li>Run /bin/win64/setup.exe -mode silent -agreeToLicense yes (<em>non-interactive install</em>)</li>
  </ol>
  
  <p>I created the following Dockerfile to set up MCR on a Microsoft windowsservercore image including dotnet-framework.</p>
  
  <pre><code># Line 1: Use dotnet-framework base image
  FROM microsoft/dotnet-framework
  
  # Line 2: Download MCR installer (self-extracting executable) and save as ZIP file
  ADD https://www.mathworks.com/supportfiles/downloads/R2014b/deployment_files/R2014b/installers/win64/MCR_R2014b_win64_installer.exe C:\\MCR_R2014b_win64_installer.zip
  
  # Line 3: Use PowerShell
  SHELL ["powershell", "-Command", "$ErrorActionPreference = 'Stop'; $ProgressPreference = 'SilentlyContinue';"]
  
  # Line 4: Unpack ZIP contents to installation folder
  RUN Expand-Archive C:\\MCR_R2014b_win64_installer.zip -DestinationPath C:\\MCR_INSTALLER
  
  # Line 5: Run the setup command for a non-interactive installation of MCR
  RUN Start-Process C:\MCR_INSTALLER\bin\win64\setup.exe -ArgumentList '-mode silent', '-agreeToLicense yes' -Wait
  
  # Line 6: Remove ZIP and installation folder after setup is complete
  RUN Remove-Item -Force -Recurse C:\\MCR_INSTALLER, C:\\MCR_R2014b_win64_installer.zip
  </code></pre>
  
  <p>I build a new image using the command:</p>
  
  <pre><code>docker build -t analytics/dotnet-mcr --no-cache --force-rm .
  </code></pre>
  
  <p>The installation of MCR is very slow, when compared to stopping at Line 4 and then manually running the MCR setup from a container based on the ensuing image (using the exact same PowerShell command)... any reason why needs an extra 3-4 minutes when performing the same step via the Dockerfile based build?</p>
  
  <p>Note: Best practices suggest using a download utility versus using <code>ADD</code>, but I don't have any constraints related to image size since I am removing intermediate images as well as deleting the downloaded installer and unpacked installation folder. Plus, I like seeing the cleaner download progress bar of the <code>ADD</code> command.</p>
  
  <p>I appreciate any improvements/optimizations that may be suggested.</p>