This article shows how to install MSI installer on Windows Docker Container using a Docker Desktop on Windows 10 OS.
MSI installer would be copied to a Container folder and runs installation with a log.
Please note that the nano-server image does not contain msiexec application under C:\Windows\System32, so server core was selected for the docker image.
Table of Contents
Prerequisites
Windows Features “Hyper-V” and “Containers” are to be enabled.
Install Docker Desktop for Windows.
Please also make sure that the Windows Container mode is selected in Docker Desktop Switch.
Pull Microsoft ServerCore docker Image
ServerCore Image with ltsc2019 tag (Windows 2019 kernel-based ServerCore) was downloaded from Microsoft published Docker Hub Link.
docker pull mcr.microsoft.com/windows/servercore:ltsc2019
Run:
Create a Dockerfile with a MSI installer file
Docker File lists command lines in a text file, which specifies automated build instructions. In this example, the node.js installer MSI was downloaded and added to the folder with this DockerFile.
As Server-Core does not support UI, msiexec.exe is to run in silent mode, /qn here.
# Run from the Microsoft ServerCore image FROM mcr.microsoft.com/windows/servercore:ltsc2019 # Create a temporary directory and Copy MSI installer to the folder of Container RUN mkdir C:\TestRun WORKDIR /TestRun COPY node-v14.18.1-x64.msi ./ RUN powershell start-Process msiexec.exe -ArgumentList '/i node-v14.18.1-x64.msi /qn /l*v nodejs14.log' -Wait
Build the Container upon DockerFile
Build a container at the working directory having DockerFile and node js installer.
docker build -t ltsc2019 .
Run:
Start the new Container
Start the container using the “docker run” command.
docker run -it --name nodejsMSIRun ltsc2019:latest cmd
-it option runs as interactive mode and cmd prompt will be opened from Container
Run:
This is a directory in Container, and you can read the log to see if MSI installation was successful.
Validate MSI correctly installed
nodejs folder has been found in the Container.