7

I'm having a hard time installing an msi via Dockerfile. My Dockerfile:

FROM microsoft/windowsservercore:latest

RUN mkdir C:\temp 
RUN mkdir C:\temp\msis

COPY . "C:/temp/msis"
RUN powershell -version 5.0 -command { Start-process -Filepath "C:\temp\msis\mySetup.msi" -ArgumentList  "/qn" -PassThru | Wait-Process}

When running docker build via:

docker build -t myTools .

I get the following error:

Step 7/7 : RUN powershell -version 5.0 -command { Start-process -Filepath "C:\temp\msis\mySetup.msi" -ArgumentList  "/qn" -PassThru | Wait-Process}
---> Running in d6f9f65d96a9
'Wait-Process}' is not recognized as an internal or external command,operable program or batch file.

If I build the container without the RUN step, and attach myself via -it to the running container and paste the command powershell -version 5.0 -command { Start-process -Filepath "C:\temp\msis\mySetup.msi" -ArgumentList "/qn" -PassThru | Wait-Process} the MSI gets installed correctly.

Has anyone an idea this failure happens?

Thx

1 Answer 1

16

Possibly it's a PowerShell parsing problem.

Try these 2 lines instead of your last line:

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

RUN Start-Process 'C:\\temp\\msis\\mySetup.msi' '/qn' -PassThru | Wait-Process;

After that you can revert to cmd.exe if you wish:

SHELL ["cmd", "/C"]
2
  • Thx for the quick response. Your answer saved my day!
    – Moerwald
    Mar 29, 2018 at 12:17
  • I was struggling with those hard-to-invoke msi installers 2 weeks ago, it's definitely not intuitive. Mar 29, 2018 at 12:19

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.