4

Container info:

Windows Server 2019 Standard image running on Windows Server 2019 Standard

I have an executable file (https://github.com/levi-blodgett/HpToolsLauncher/blob/main/HpToolsLauncher.exe, a plugin inside of Jenkins supplies then runs the executable) that I cannot get any output from no matter what I do, if you just call the .exe outright on any other systems I have tried (Windows 10 and Windows Server 2019 systems) this is the output:

C:\Users\LeviBlodgett\Documents\dependencies>.\HpToolsLauncher.exe   
"Started..."
Micro Focus Automation Tools Command Line Executer
Usage: HpToolsLauncher.exe  -paramfile <a file in key=value format>   -encoding ASCII | UTF-7 |
UTF-8 | UTF-16
...etc...

This .exe should produce this output when called from the command line in any directory, and the permissions are good.

However when ran inside my docker container (after connecting with "docker exec -it <container_id> powershell"):

PS C:\dependencies> .\HpToolsLauncher.exe
PS C:\dependencies> 

No setup is needed for this .exe to run, it is the exact same file, I have checked:

    .NET version
    Permissions
    Security
    Dependencies (possible I missed something, was using https://github.com/lucasg/Dependencies)
    Running on cmd and powershell, as user and as admin
    https://stackoverflow.com/questions/60823381/unable-to-run-32-bit-exe-in-windows-containers (tested the executable on a new image with no config, using the 02.20.20 release of MS core and I still get no output.

Examples of .exe files I can either get output from or see the process for in the container:

notepad.exe
git.exe
python.exe

Dockerfile:

FROM jenkins/jenkins:jdk11-hotspot-windowsservercore-2019

# set paths
RUN $env:PATH = $env:PATH + ';C:\Python\;C:\Python\lib\site-packages\;C:\Python\Scripts\;C:\Users\jenkins\AppData\Roaming\Python\Python310\Scripts;C:\MinGit\cmd\;C:\MinGit\cmd'; \
Set-ItemProperty -Path 'HKLM:\SYSTEM\CurrentControlSet\Control\Session Manager\Environment\' -Name Path -Value $env:PATH;

# download, install mingit
RUN Invoke-WebRequest 'https://github.com/git-for-windows/git/releases/download/v2.12.2.windows.2/MinGit-2.12.2.2-64-bit.zip' -OutFile MinGit.zip; \
Expand-Archive c:\MinGit.zip -DestinationPath c:\MinGit;

# download, install Python 3
RUN Invoke-WebRequest 'https://www.python.org/ftp/python/3.10.6/python-3.10.6-embed-amd64.zip' -OutFile python.zip; \
Expand-Archive c:\python.zip -DestinationPath c:\Python;

# download, install pip
RUN curl https://bootstrap.pypa.io/get-pip.py -o get-pip.py ; \
python get-pip.py ; \
Add-Content -Path C:\Python\python310._pth -Exclude help* -Value 'lib\site-packages';

# download, install pip packages
RUN pip install imap_tools requests;

# download, set shell, then install visualsvn
RUN Invoke-WebRequest 'https://www.visualsvn.com/files/VisualSVN-Server-5.0.3-x64.msi' -OutFile svn.msi;
SHELL ["powershell", "-Command", "$ErrorActionPreference = 'Stop'; $ProgressPreference = 'SilentlyContinue';"];
RUN Start-Process 'svn.msi' '/qn /norestart /L*V "svn.log"' -PassThru | Wait-Process;

# download, install Dependencies.exe and HpToolsLauncher.exe
COPY ./dependencies C:\\dependencies

EDITS/UPDATES:

I tried adding the missing DLL ((x86) version of GdiPlus.dll) into C:\Windows\SysWOW64\ and then registering but it still did not work:

PS C:\> C:\Windows\SysWOW64\regsvr32 /s /i “C:\Windows\SysWOW64\GdiPlus.dll”
PS C:\> C:\dependencies\HpToolsLauncher.exe
PS C:\> $?
False
PS C:\> $LASTEXITCODE
-1073741511
PS C:\> 

However it is worth noting that when I run:

.\Dependencies.exe -json -knowndll .\HpToolsLauncher.exe

It doesn't show gdiplus.dll under x86 even though I registered it, so perhaps I am not adding it correctly for docker.

5
  • Can you check the contents of $?, $LASTEXITCODE?
    – criztovyl
    Commented Sep 9, 2022 at 17:15
  • PS C:\> $? False PS C:\> $LASTEXITCODE -1073741511 Commented Sep 9, 2022 at 17:51
  • searching around for that error number brought up stackoverflow.com/a/34140735, suggesting some dll might be missing in the container.
    – criztovyl
    Commented Sep 9, 2022 at 18:06
  • I think I found that GdiPlus.dll is missing from C:\Windows\SysWOW64\ in the container, will update again once I test. Commented Sep 9, 2022 at 18:27
  • @criztovyl Edited post with output, end of the original post Commented Sep 9, 2022 at 19:22

2 Answers 2

3
+100

This problem is discussed in the bug-report
Unable to load DLL 'gdiplus.dll' when using Windows based docker images #1098 .

The explanation is that the base image you used does not contain System.Drawing.Common and the file gdiplus.dll.

You need a container that uses a ServerCore image (which apparently you did) and to add in the dotnet core runtime and aspnet core runtime.

Here is an example that uses for simplicity chocolatey to install them:

#
# This base image is to host dotnet core asp apps on servercore images 
# to better support things like GDI+ image manipulation or COM
#

FROM  mcr.microsoft.com/windows/servercore:1803
SHELL ["powershell", "-Command", "$ErrorActionPreference = 'Stop'; $ProgressPreference = 'SilentlyContinue';"]

WORKDIR /app
RUN iex ((New-Object System.Net.WebClient).DownloadString('https://chocolatey.org/install.ps1')); \
    choco install dotnetcore-runtime --version 2.2.7 -y; \
    choco install aspnetcore-runtimepackagestore --version 2.2.7 -y

ENV ASPNETCORE_URLS http://*:80
EXPOSE 80

Use the dotnet versions that match your base image.

4
  • I have tried to use this as a dockerfile, utilizing servercore:ltsc2019, but I get errors when installing dotnetcore-runtime and aspnetcore-runtimepackagestore, have tried versions 2.2.7, 3.1.28, and no version defined. I get the same error of -1073741511 for installing those. Added chocolatey.log to the GitHub project above. I believe you are right for sure, but I guess maybe I have to add a comment directly to this GitHub issue for Windows Server 2019. Open to suggestions on next steps. Commented Sep 12, 2022 at 14:51
  • Error code 0xc0000139 (-1073741511) is issued when failing to load a DLL file. I think .NET Framework 4.8 was the last one supported by Windows Server 2019 which should be version 1803 at least (link).
    – harrymc
    Commented Sep 12, 2022 at 18:58
  • Not sure I am fully understanding your comment, tried more .net runtime packages and aspnetcore packages versions but still to no avail, keep getting those errors. Regardless you are right so I will award you the bounty, but if you have any tips on what I am missing I appreciate it. Commented Sep 15, 2022 at 13:52
  • Thank you. Unfortunately I don't have the environment for testing. Perhaps you can find a ready-made image that already contains these packages. See this link and especially the first entry below "Windows Server Core 2019 amd64 Tags". Note that nanoserver can be used with .Net 6.
    – harrymc
    Commented Sep 15, 2022 at 14:33
0

posting just in case it will help someone, for me windows update to the host machine resolved this issue (not the same exe of op but another one)

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .