Answer a question

i'm trying to run a docker container on Windows 10 which should execute a windows executable (myprogram.exe). Below you find my dockerfile:

FROM microsoft/windowsservercore
COPY mydir/myprogram.exe /mydir/
CMD ["/mydir/myprogram.exe","someparameter"]

So i build the image with: docker image build --tag myimage . and run the container with: docker run myimage Unfortunately if I check the status of the container with: docker ps -a I can see that the container has exited with

exit code 3221225781

, which seems to point to a missing dll. To debug the problem I run the command: docker run -it --name debug microsoft/windowsservercore cmd, stopped the container and copied the windows executable in the container file system : docker cp myprogram.exe debug:c:/myprogram.exe Now I start the container again using docker start -i debug and enter myprogram.exe myparameter. Unfortunately the program exits immediately (usually it runs about 30 sec) without any output, error code ... My only explanation for this behavior is that if some cmd program is missing some dll's the corresponding error message is not included in the STDERR but rather in a message dialog. Apparently docker doesn't support this feature??? So what is the best was to solve this problem. Using dependency walker to go through all dll's needed is possible but would take some time and I'm looking for some more elegant solution.

Answers

You need to install Visual C++ redistributable.

  1. Download the appropriate version of vc_redist.x64.exe and place it in the folder containing your Dockerfile

  2. Edit your Dockerfile so you preinstall VC++ redistributables when you build your image by adding:

    FROM mcr.microsoft.com/windows/sservercore

    WORKDIR c:\mydir

    COPY "vc_redist.x64.exe" .

    RUN vc_redist.x64.exe /install /passive /norestart /log out.txt

    COPY mydir/myprogram.exe c:\mydir

    CMD ["c:\mydir\myprogram.exe","someparameter"]

Your application should run now.

Note: you need 64-bit build of VC++ redistributable and the appropriate version. You can find some download urls here

Logo

云原生社区为您提供最前沿的新闻资讯和知识内容

更多推荐