I am trying to silent install an MSI in PowerShell. The OpenJDK MSI downloaded from AdoptOpenJDK.
Need silent install because I am doing it when building my Windows JDK11 docker image.
First download the AdoptOpenJDK OpenJDK 11
Invoke-WebRequest https://api.adoptopenjdk.net/v3/installer/latest/11/ga/windows/x64/jdk/hotspot/normal/adoptopenjdk?project=jdk -OutFile C:\Temp\openjdk11.msi
Trying with silent install:
Start-Process -Wait -FilePath msiexec -ArgumentList /i, "C:\Temp\openjdk11.msi", "ADDLOCAL=FeatureMain,FeatureEnvironment,FeatureJarFileRunWith,FeatureJavaHome", "INSTALLDIR='C:\Program Files\Java'", /quiet
The install process just hangs there forever.
Got a solution. It works when running it manually in PowerShell, but hangs still with docker build.
I am able to run the PowerShell command manually
docker run -it -v C:\Temp:C:\Temp:rw -w C:\Temp mcr.microsoft.com/windows:1903 powershell
Start-Process -Wait -FilePath msiexec -ArgumentList /i, "C:\Temp\openjdk11.msi", 'ADDLOCAL="FeatureMain,FeatureEnvironment,FeatureJarFileRunWith,FeatureJavaHome"', 'INSTALLDIR="C:\Program Files\Java\jdk-11\"', /quiet, /norestart -Verb RunAs
When running the command in Docker build, it still hangs forever.
Step 5/15 : ADD https://api.adoptopenjdk.net/v3/installer/latest/11/ga/windows/x64/jdk/hotspot/normal/adoptopenjdk?project=jdk C:\Temp\openjdk11.msi
Downloading [==================================================>] 173.4MB/173.4MB
---> 387ac55cb949
Step 6/15 : RUN Start-Process -Wait -FilePath msiexec -ArgumentList /i, "C:\Temp\openjdk11.msi", 'ADDLOCAL="FeatureMain,FeatureEnvironment,FeatureJarFileRunWith,FeatureJavaHome"', 'INSTALLDIR="C:\Program Files\Java\jdk-11\"', /quiet, /norestart -Verb RunAs
---> Running in 1fd5fd30c901
My Dockerfile
# escape=`
FROM mcr.microsoft.com/windows:1903 AS jdk11
SHELL [ "powershell", "-Command", "$ErrorActionPreference = 'Stop'; $ProgressPreference = 'SilentlyContinue';"]
ADD https://api.adoptopenjdk.net/v3/installer/latest/11/ga/windows/x64/jdk/hotspot/normal/adoptopenjdk?project=jdk C:\Temp\openjdk11.msi
RUN Start-Process -Wait -FilePath msiexec -ArgumentList /i, "C:\Temp\openjdk11.msi", 'ADDLOCAL="FeatureMain,FeatureEnvironment,FeatureJarFileRunWith,FeatureJavaHome"', 'INSTALLDIR="C:\Program Files\Java\jdk-11\"', /quiet, /norestart -Verb RunAs