skip to Main Content

I’m trying to make an image with a windows container with some pre-installed programs that my .NET app needs in order to work.

I copied all the EXE files into the container successfully but was unable to install them using the CMD as a shell or Powershell as a shell with the Start-Process command.

When I’m running these commands within the container it outputs nothing, and when I’m running it using the RUN command inside the Dockerfile in just hang on the command.

There’s any way to install EXE programs on a windows container?

Edit:
My Dockerfile contains:
enter image description here

2

Answers


  1. Start-Process should work in your container.

    For reference, here is a working Dockerfile for installing Java 11 into a Windows container:

    FROM mcr.microsoft.com/windows/servercore:ltsc2019-amd64
    
    ARG src="jdk-11.0.16_windows-x64_bin.exe"
    ARG target="C:/"
    COPY ${src} ${target}
    
    RUN powershell Start-Process -filepath 'C:/jdk-11.0.16_windows-x64_bin.exe' -Wait -PassThru -ArgumentList "/s"
    
    ENV JAVA_HOME "C:Program FilesJavajdk-11.0.16"
    

    Here are a few changes to try:

    • For your case, place your /qn argument after the -ArgumentList flag. The final RUN statement should look more like this –
    RUN powershell ; 
     $ErrorActionPreference = 'Stop' ; 
     $ProgressPreference = 'SilentlyContinue' ; 
     Start-Process -filepath './bin/Basler_pylon_6.2.0.21487.exe' -Wait -PassThru -ArgumentList "/qn"
    
    • The USER ContainerAdministrator statement is not needed. That is already the Docker default.
    Login or Signup to reply.
  2. In addition to the comment above, I have a things:

    • The Windows image you’re using is not supported anymore. I recommend you try the Server Core image or the Server image. The latter is only supported on Windows Server 2022 nodes (or Windows 11).
    • I noticed your screenshot looks like a Mac. Are you running on a Mac or is that just the screenshot? Windows containers require a Windows host to run.
    • Can you run a container interactively to try and run the command? You can try docker run -it --entrypoint mcr.microsoft.com/windows/servercore:ltsc2022 (or ltsc2019 on a Windows Server 2019/Windows 10)
    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search