Correctly install a MSI setup during docker build
In the Dokerfile I have
# escape=`
FROM microsoft/windowsservercore:1803
SHELL [ "powershell", "-Command"]
ADD "http://download.backup4all.com/download/setup/b4asetup.msi" c:/msi/
RUN Start-Process msiexec.exe -ArgumentList '-i', 'c:\msi\b4asetup.msi', '/quiet', '/norestart' -NoNewWindow
Actual behavior
The install fails with with error 1719. 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.
Information
docker info
Containers: 1
Running: 0
Paused: 0
Stopped: 1
Images: 435
Server Version: 17.06.2-ee-13
Storage Driver: windowsfilter
Windows:
Logging Driver: json-file
Plugins:
Volume: local
Network: l2bridge l2tunnel nat null overlay transparent
Log: awslogs etwlogs fluentd json-file logentries splunk syslog
Swarm: inactive
Default Isolation: process
Kernel Version: 10.0 17134 (17134.1.amd64fre.rs4_release.180410-1804)
Operating System: Windows Server Standard
OSType: windows
Architecture: x86_64
CPUs: 4
Total Memory: 7.689GiB
Name: DOCKERCORE
ID: HVX2:N6BQ:ZOLP:MSOR:OXIN:BK5T:QW6D:AGZH:VW5H:WWJO:2DVK:5V3X
Docker Root Dir: C:\ProgramData\docker
Debug Mode (client): false
Debug Mode (server): false
Registry: https://index.docker.io/v1/
Experimental: false
Insecure Registries:
127.0.0.0/8
Live Restore Enabled: false
docker version
Client:
Version: 17.06.2-ee-13
API version: 1.30
Go version: go1.8.7
Git commit: ac44d73
Built: Mon Jun 4 16:46:59 2018
OS/Arch: windows/amd64
Server:
Engine:
Version: 17.06.2-ee-13
API version: 1.30 (minimum version 1.24)
Go version: go1.8.7
Git commit: ac44d73
Built: Mon Jun 4 16:58:47 2018
OS/Arch: windows/amd64
Experimental: false
The same Dockerfile works on Windows 10 but fails on Windows Server 1803.
This happens all the time.
Steps to reproduce the behavior
Using the Dockerfile listed above run docker build
An error might or might not be displayed during Step 3/5 T h e W i n d o w s I n s t a l l e r S e r v i c e c o u l d n o t b e a c c e s s e d . T h i s c a n o c c u r i f t h e W i n d o w s I n s t a l l e r i s n o t c o r r e c t l y i n s t a l l e d . C o n t a c t y o u r s u p p o r t p e r s o n n e l f o r a s s i s t a n c e .
Start a container and verify that the dir "C:\Program Files (x86)" command lists only
common files
internet explorer
Microsoft.NET
WindowsPowerShell
I am having the same problem now on Windows Server 2019 host.
The following Dockerfile builds successfully on Windows 10 Pro 1903, but fails on Windows Server 2019 Standard 1809.
FROM mcr.microsoft.com/dotnet/framework/sdk:4.8-windowsservercore-ltsc2019
ADD https://www.visualsvn.com/files/VisualSVN-Server-4.2.2-x64.msi /VisualSVN-Server-4.2.2-x64.msi
RUN msiexec.exe /i VisualSVN-Server-4.2.2-x64.msi /qn /norestart /L*V "VisualSVN-Server-4.2.2-x64.log"
CMD powershell
Looking at the log, I get the following error:
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.
Other thing worth mentioning is that on Win 10 Pro, Docker Desktop (CE) is installed
Client: Docker Engine - Community
Version: 19.03.8
API version: 1.40
Go version: go1.12.17
Git commit: afacb8b
Built: Wed Mar 11 01:23:10 2020
OS/Arch: windows/amd64
Experimental: false
Server: Docker Engine - Community
Engine:
Version: 19.03.8
API version: 1.40 (minimum version 1.24)
Go version: go1.12.17
Git commit: afacb8b
Built: Wed Mar 11 01:37:20 2020
OS/Arch: windows/amd64
Experimental: false
but on Win Server 2019 Docker Enterprise Edition (EE) is installed.
Client: Docker Engine - Enterprise
Version: 19.03.5
API version: 1.40
Go version: go1.12.12
Git commit: 2ee0c57608
Built: 11/13/2019 08:00:16
OS/Arch: windows/amd64
Experimental: false
Server: Docker Engine - Enterprise
Engine:
Version: 19.03.5
API version: 1.40 (minimum version 1.24)
Go version: go1.12.12
Git commit: 2ee0c57608
Built: 11/13/2019 07:58:51
OS/Arch: windows/amd64
Experimental: false
One more detail: Windows Server 2019 is running on VM.
I have had similar issues where msi installs have failed and the error messages imply that the Windows Installer is not installed correctly. My issue turned out to be that the item being installed was a service, and the service was dependent on the Visual C++ runtime. The C++ runtime had not been installed in the image prior to running the msi. As a result, the msi could install the service, but could not start the service, and the msi rolled everything back. Once I got the C++ runtime installed prior to the msi, it started working.
Ideally, the msi itself should check if the required runtime is present and install it if it isn’t. Hope this helps.
is working fine on both host OS-es (Win 10 Pro and Win Server 2019).
In never ending quest to find the correct installer invoking method, I got the idea from this SO thread:
So basically, if I start my msi installer in pshell (or is it the wait command?) everything works fine, if I use msiexec it doesn’t work but only on Win Server host.
I still don’t know why is this happening and I am happy to hear someone with more expertise explaining it, since I just started using Docker and I am in shock on how something so trivial such as running the installer turned out to be such a pain in the a**.
Content from my msi log:
Error 1719. Windows Installer service co
uld not be accessed. Contact your support personnel to verify that it is properly registered and enabled
My docker file:
# escape=`
FROM mcr.microsoft.com/windows/servercore:ltsc2019
SHELL ["powershell", "-Command", "$ErrorActionPreference = 'Stop'; $ProgressPreference = 'SilentlyContinue';"]
WORKDIR c:\shareddata
COPY data c:\shareddata
RUN [Net.ServicePointManager]::SecurityProtocol = 'Tls12, Tls11, Tls'
RUN ls
RUN Start-Process 'vcredist_x64.exe' '/q /norestart' -PassThru | Wait-Process;
RUN Start-Process 'VC_redist.x64.exe' '/q /norestart' -PassThru | Wait-Process;
RUN Start-Process 'rktools.msi' '/qn /norestart /L*V "rktools.msi.log"' -PassThru | Wait-Process;
RUN get-process
SHELL ["cmd", "/S", "/C"]
Noting worked for me, I then share what actually worked if it can help someone in the future, NOT setting defaul shell to powershell with:
SHELL ["powershell", ...]
since there are commands failing in powershell but working find with CMD, that is the default one, including the my MSI install, and when I want to run a powershell command I run:
RUN powershell -Command "..."
Anyway, back to the topic, in order to install my MSI I simply call it from RUN as I would call it from command prompt:
RUN C:\msodbcsql.msi /qn /norestart /log MsOdbcSqlDriverSetup.log IACCEPTMSODBCSQLLICENSETERMS=YES