trouble debugging error with exit code 3221225781 (missing libraries) in windows docker container
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.
-
Download the appropriate version of vc_redist.x64.exe and place it in the folder containing your Dockerfile
-
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
更多推荐
所有评论(0)