Agendum
Agendum

Reputation: 2011

How to install Access Runtime on a Docker container?

I would like to install the Access Runtime on a Docker container, but I am getting a failure when doing so. Here are basic commands to reproduce the error.

First start an interactive shell with a new Windows container:

docker container run -it mcr.microsoft.com/windows:1809-amd64 cmd.exe

Next run the following script to reproduce:

cd /d C:\
curl https://download.microsoft.com/download/D/B/D/DBD20EF9-A945-4768-AEB0-617BCEA2214A/accessruntime_4288-1001_x64_en-us.exe -o accessruntime_4288-1001_x64_en-us.exe
accessruntime_4288-1001_x64_en-us.exe /quiet /extract:C:\AccessRuntime
echo ^<Configuration Product="AccessRT"^> > accessruntime_4288-1001_x64_en-us.config
echo ^<Display Level="None" CompletionNotice="no" SuppressModal="yes" AcceptEula="yes" /^> >> accessruntime_4288-1001_x64_en-us.config
echo ^<Logging Type="standard" Path="C:\Windows\Temp\" Template="Microsoft_Access_2016_Runtime_Setup(*).log" /^> >> accessruntime_4288-1001_x64_en-us.config
echo ^<COMPANYNAME Value="Company Name" /^> >> accessruntime_4288-1001_x64_en-us.config
echo ^<Setting Id="SETUP_REBOOT" Value="Never" /^> >> accessruntime_4288-1001_x64_en-us.config
echo ^</Configuration^> >> accessruntime_4288-1001_x64_en-us.config
del C:\Windows\Temp\Microsoft_Access_2016_Runtime_Setup*.log
cmd /C C:\AccessRuntime\setup.exe /config C:\accessruntime_4288-1001_x64_en-us.config
echo Access Runtime Setup exited with code: %errorlevel%, See below for logs:
findstr /spin CAInstallLicenses C:\Windows\Temp\Microsoft_Access_2016_Runtime_Setup*.log

For readability, this is the config the script generates as an input:

<Configuration Product="AccessRT">
<Display Level="None" CompletionNotice="no" SuppressModal="yes" AcceptEula="yes" />
<Logging Type="standard" Path="C:\Windows\Temp\" Template="Microsoft_Access_2016_Runtime_Setup(*).log" />
<COMPANYNAME Value="Company Name" />
<Setting Id="SETUP_REBOOT" Value="Never" />
</Configuration>

Here is the output:

Access Runtime Setup exited with code: 1603, See below for logs:

C:\Windows\Temp\Microsoft_Access_2016_Runtime_Setup(2020022408475199C).log:9975:2020/02/24 08:49:01:598::[1176] MSI(ACTIONSTART): 'Action 8:49:01: PrepareCAInstallLicenses. '
C:\Windows\Temp\Microsoft_Access_2016_Runtime_Setup(2020022408475199C).log:9976:2020/02/24 08:49:01:598::[1176] MSI(INFO): 'Action start 8:49:01: PrepareCAInstallLicenses.'
C:\Windows\Temp\Microsoft_Access_2016_Runtime_Setup(2020022408475199C).log:9977:2020/02/24 08:49:01:614::[1176] MSI(INFO): 'PrepareCAInstallLicenses:  OMSICA : Initializing CustomAction PrepareCAInstallLicens
es'
C:\Windows\Temp\Microsoft_Access_2016_Runtime_Setup(2020022408475199C).log:9978:2020/02/24 08:49:01:630::[1176] MSI(INFO): 'PrepareCAInstallLicenses:  PHN license not supplied for ACID: 9D9FAF9E-D345-4B49-AFC
E-68CB0A539C7C'
C:\Windows\Temp\Microsoft_Access_2016_Runtime_Setup(2020022408475199C).log:9979:2020/02/24 08:49:01:630::[1176] MSI(INFO): 'PrepareCAInstallLicenses:  RAC-Private license not supplied for ACID: 9D9FAF9E-D345-
4B49-AFCE-68CB0A539C7C'
C:\Windows\Temp\Microsoft_Access_2016_Runtime_Setup(2020022408475199C).log:9980:2020/02/24 08:49:01:630::[1176] MSI(INFO): 'PrepareCAInstallLicenses:  RAC-Public license not supplied for ACID: 9D9FAF9E-D345-4
B49-AFCE-68CB0A539C7C'
C:\Windows\Temp\Microsoft_Access_2016_Runtime_Setup(2020022408475199C).log:9981:2020/02/24 08:49:01:645::[1176] MSI(INFO): 'Action ended 8:49:01: PrepareCAInstallLicenses. Return value 1.'
C:\Windows\Temp\Microsoft_Access_2016_Runtime_Setup(2020022408475199C).log:10205:2020/02/24 08:49:09:708::[1176] MSI(ACTIONSTART): 'Action 8:49:09: CAInstallLicenses. '
C:\Windows\Temp\Microsoft_Access_2016_Runtime_Setup(2020022408475199C).log:10206:2020/02/24 08:49:09:708::[1176] MSI(INFO): 'Action start 8:49:09: CAInstallLicenses.'
C:\Windows\Temp\Microsoft_Access_2016_Runtime_Setup(2020022408475199C).log:10207:2020/02/24 08:49:09:723::[1176] MSI(INFO): 'Action ended 8:49:09: CAInstallLicenses. Return value 1.'
C:\Windows\Temp\Microsoft_Access_2016_Runtime_Setup(2020022408475199C).log:10275:2020/02/24 08:49:32:270::[1176] MSI(ACTIONSTART): 'Action 8:49:32: CAInstallLicenses. '
C:\Windows\Temp\Microsoft_Access_2016_Runtime_Setup(2020022408475199C).log:10276:2020/02/24 08:49:32:286::[1176] MSI(INFO): 'CAInstallLicenses:  OMSICA : Initializing CustomAction CAInstallLicenses'
C:\Windows\Temp\Microsoft_Access_2016_Runtime_Setup(2020022408475199C).log:10277:2020/02/24 08:49:32:302::[1176] MSI(INFO): 'CAInstallLicenses:  Populating the Token Store'
C:\Windows\Temp\Microsoft_Access_2016_Runtime_Setup(2020022408475199C).log:10278:2020/02/24 08:49:32:302::[1176] MSI(INFO): 'CAInstallLicenses:  Installing license: sl.ISSUANCE.CLIENT_ROOT'
C:\Windows\Temp\Microsoft_Access_2016_Runtime_Setup(2020022408475199C).log:10279:2020/02/24 08:49:32:302::[1176] MSI(INFO): 'CAInstallLicenses:  Error: Failed to open Token Store HResult: 0xc0020036. '
C:\Windows\Temp\Microsoft_Access_2016_Runtime_Setup(2020022408475199C).log:10280:2020/02/24 08:49:32:302::[1176] MSI(INFO): 'CustomAction CAInstallLicenses returned actual error code 1603 (note this may not b
e 100% accurate if translation happened inside sandbox)'
C:\Windows\Temp\Microsoft_Access_2016_Runtime_Setup(2020022408475199C).log:11247:2020/02/24 08:50:08:161::[1176] MSI(INFO): 'Property(S): CAInstallLicenses = **********'
C:\Windows\Temp\Microsoft_Access_2016_Runtime_Setup(2020022408475199C).log:11405:2020/02/24 08:50:08:208::[1176] MSI(INFO): 'Property(S): MsiHiddenProperties = CAInstallLicenses;CAInstallPidKey;DigitalProduct
ID;DPID;PIDKEY;VerifyProdReg'

Searching for this error makes me believe it has something to do with Windows or Office activation. But since this is a Docker container, how can I resolve this problem?

Upvotes: 4

Views: 4649

Answers (2)

J&#252;rgen Steinblock
J&#252;rgen Steinblock

Reputation: 31723

I really struggled to get the access database engine running in a container for ci builds. My .NET app uses Microsoft.ACE.OLEDB.12.0 data provider to import data from excel files and I wanted my test to run inside a docker container

I am using mcr.microsoft.com/windows:ltsc2019 container image and this post here was the best source to get started.

However, I tried everything from @Agendum 's solution and much more but I couldn't manage to sucessfully install the runtime.

Eventually I found a solution myself which I want to share

First I downloaded the Microsoft Access Database Engine 2016 Redistributable from here https://www.microsoft.com/en-us/download/details.aspx?id=54920

The direct links are https://download.microsoft.com/download/3/5/C/35C84C36-661A-44E6-9324-8786B8DBE231/accessdatabaseengine.exe and https://download.microsoft.com/download/3/5/C/35C84C36-661A-44E6-9324-8786B8DBE231/accessdatabaseengine_X64.exe

After that I installed the runtime with

cmd.exe /c accessdatabaseengine.exe /quiet /norestart

I found the switch documented here

As @Agendum mentioned, without the cmd.exe /c the command would return immediately and the setup would continue in the background. The neat thing is that you can install both runtimes in parallel, which I believe wouldn't be possible without the /quiet switch because if one version is installed the setup would refuse to install the other.

Here is a fully working dockerfile.

FROM mcr.microsoft.com/windows:ltsc2019

SHELL ["powershell", "-Command"]

WORKDIR C:\\Tools

# install Access Database Engine
RUN curl https://download.microsoft.com/download/3/5/C/35C84C36-661A-44E6-9324-8786B8DBE231/accessdatabaseengine.exe -o accessdatabaseengine.exe; \
    cmd.exe /c accessdatabaseengine.exe /quiet /norestart; \
    curl https://download.microsoft.com/download/3/5/C/35C84C36-661A-44E6-9324-8786B8DBE231/accessdatabaseengine_X64.exe -o accessdatabaseengine_X64.exe; \
    cmd.exe /c accessdatabaseengine_x64.exe /quiet /norestart; \
    del accessdatabaseengine*.exe

Upvotes: 2

Agendum
Agendum

Reputation: 2011

After many many hours of trial and error and internet searching, I can happily say that I managed to get the Access Runtime successfully installed on a Docker container. A response on this thread led me in the right direction.

The sun, moon, and stars must all align to get this to work, so I hope this answer helps somebody out in the future.

First, for the record, I am using base image FROM mcr.microsoft.com/windows:1809-amd64, which is deployable to Azure. Unfortunately a servercore image isn't an option because the Access Database Engine (a separate dependency I had) doesn't work on servercore.

Second, during the install you must be using USER ContainerAdministrator.

Third, before running setup.exe you must set this registry key:

reg.exe add HKLM\System\CurrentControlSet\Services\sppsvc /v Start /t REG_DWORD /d 2 /f

I don't entirely know what this does, but has does something to do with activation. It puts the OS in a state which is sufficient enough for the Access Runtime to be installed. This the piece I got on that thread.

By default the value was 4, and this puts the value to 2. After the install I did not restore this to 4, nor did I test it.

Another important point is that setting this registry setting must be in a RUN statement before and independently of the RUN which launches setup.exe. This is because a reboot is required after setting it. This means one cannot manually test this alone from a shell, and must use a Dockerfile to test this end-to-end.

Fourth, when launching setup.exe you must launch it in a very specific way:

RUN cmd.exe /C setup.exe /config temp.log

What is important here is the extra cmd.exe /C. The reason for that is because setup.exe launches a new shell and returns immediately if you don't have cmd.exe /C. This means the action yields immediately back to Docker and it gets into a wierd state. It took me a while to figure that out. cmd.exe /C allows it to sufficiently wait. In fact I use PowerShell just to be extra certain:

$access_runtime_setup_process = Start-Process -FilePath 'cmd.exe' -ArgumentList \"/C $access_runtime_temp_directory\setup.exe /config $access_runtime_config_file\" -NoNewWindow -Wait -PassThru; `
if ($access_runtime_setup_process.ExitCode -ne 0) { `
    Write-Host \"PROCESS FAILED: $access_runtime_temp_directory\setup.exe (Exit Code: $($access_runtime_setup_process.ExitCode))\"; `
    exit 1; `
}

Finally, I ended up installing the Access Database Engine after the Access Runtime. I didn't test the other way around, it probably works also.

After installing the Access Database Engine, I did a USER ContainerUser to restore the user.

I did not need the VC Runtime or the .NET Framework installed, the only things I needed to install were the runtime and database engine.

If anybody else ends up having to experience the pain of using legacy software like Access in a Docker container, I hope this helps you!

Upvotes: 10

Related Questions