Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Installing msi on a docker container

Need help with dockerizing legacy application I have a legacy app which contains multiple components(msi installers). These components use variety of technologies like C#, windows forms, C++, MFC, .net remoting, C# webservices(asmx). Out of these components a couple of them are desktop ui applications. I was researching the feasibility of dockerizing these components. I am aware that it is not possible to display UI from docker containers, but the UI components also have a command-line counterpart using which we can perform all the operations which can be done with UI. I started with a simple component. This contains asmx web services developed in C# and is generally hosted on IIS on a windows machine. It installs its files into the following locations

  1. C:\program Files\ ==> configurable
    1. C:\programData\

I created the docker file with following actions

  1. take a windows server core image and enable iis and other dependencies
    1. Copy the installer from host machine to the container
    2. Run the installer in silent mode using msiexec command.

When I run docker build command using this docker file, I am getting an error Could not access network location "C:\Program Files\\

No help from google. Can anybody help me in getting around the issue. I have a couple of questions 1. Does a docker container by default contain default windows directories like program files, program files(x86), user profile, Program data and app data?

edit: Apologies for delayed response. Providing the docker file below

FROM microsoft/aspnet
WORKDIR C:\\Installers
COPY EKBCS.exe C:\\Installers\\myinstaller.exe
COPY EKBCS.properties C:\\Installers\\myinstaller.properties
#RUN msiexec /unreg
#RUN msiexec /regserver
#RUN ["net start", "msiserver"]
RUN ["myinstaller.exe", "/l*v myinstaller.log",  "/qn PROPERTYFILE=myinstaller.properties"]
ENTRYPOINT ["powershell"]

Following is the error in the installer log.

-- Error 1719. The Windows Installer Service could not be accessed. This can occur if you are running Windows in safe mode, or if the Windows Installer is not correctly installed. Contact your support personnel for assistance.

I tried unregistering and registering msi installer service but that doesnt help. Hence commented those lines. Any help very much appreciated.

like image 419
Satish Avatar asked Apr 25 '19 09:04

Satish


1 Answers

I've done similar work 2 years ago, dockerizing some C# code we had in our organisation.
Here's a snippet from one of the Dockerfile that should help you achieve what you are trying to do -

FROM microsoft/windowsservercore

SHELL ["powershell", "-Command", "$ErrorActionPreference = 'Stop'; $ProgressPreference = 'SilentlyContinue';"]

#Copy installers
RUN (New-Object System.Net.WebClient).DownloadFile('https://download.microsoft.com/download/B/4/A/B4A8422F-C564-4393-80DA-6865A8C4B32D/MicrosoftAzureAuthoringTools-x64.msi', 'c:\tools\MicrosoftAzureAuthoringTools-x64.msi') ;\
    (New-Object System.Net.WebClient).DownloadFile('https://download.microsoft.com/download/B/4/A/B4A8422F-C564-4393-80DA-6865A8C4B32D/MicrosoftAzureLibsForNet-x64.msi', 'c:\tools\MicrosoftAzureLibsForNet-x64.msi') ;\
    Start-Process 'msiexec' -ArgumentList '/i c:\tools\MicrosoftAzureAuthoringTools-x64.msi /quiet /qn /norestart /log c:\tools\installAuth.log'; \
    Start-Sleep -s 30 ;\
    Start-Process 'msiexec' -ArgumentList '/i c:\tools\MicrosoftAzureLibsForNet-x64.msi /quiet /qn /norestart /log c:\tools\installLib.log';\
    Start-Sleep -s 30 ;\
    Remove-Item c:\tools\*.msi -force

My example downloads the files from the internet, then installs it from the c:\tools folder to which they were downloaded to, but it should work just as well and also eliminates dependency on files existing on the host machine.
Hope it helps.

like image 195
Yaron Idan Avatar answered Oct 30 '22 03:10

Yaron Idan