Docker Community Forums

Share and learn in the Docker community.

Cannot get CPP exe running in Windows Nano container if dlls are referenced in code

Hi experts out there,

I am trying to get a cpp exe runing in Windows Nano. This exe includes a JVM via JNI (basically it references jvm.dll), as well as references an unmanaged cpp dll which in turn references managed C# dlls. The dlls are located in the same folder as the exe. The exe does not offer a GUI and can be run on command line, printing a “usage” text when started with the “-h” argument.

When creating a Windows Nano container with the following Dockerfile content:
FROM mcr.microsoft.com/windows/nanoserver:1903
WORKDIR /app
COPY . .
The exe does not start up and print anything.
When changing the code by eliminating all places referencing the dlls (including the code firing up the JVM), the exe starts fine and prints the “usage” text as expected.

After some reading I decided to try with Windows Core first, as this should be the “easier” option. So I generated a Windows Core container with the following Dockerfile content:
FROM mcr.microsoft.com/windows/servercore:20H2
WORKDIR /app
COPY . .
The result was exactly the same as with the Windows Nano image.

So I added the VC redistributable installation to the container:
USER ContainerAdministrator
ADD /vc_redist.x64.exe
RUN C:\vc_redist.x64.exe /quiet /install
With this the exe starts fine and prints the “usage” text in both “versions”: with and without the code referencing the dlls. This is exactly what I wanted.

Now I tried to apply this to the Windows Nano container too. Unfortunately when running “docker build -t …” I get the following error:
Step 6/6 : RUN C:\vc_redist.x64.exe /quiet /install
—> Running in d2f924ba4117
The command ‘cmd /S /C C:\vc_redist.x64.exe /quiet /install’ returned a non-zero code: 3221225781

How can I get the exe running on Windows Nano? Or how do I get the VC runtime installed on Windows Nano?

Cheers,
Michael