Q:

trouble debugging error with exit code 3221225781 (missing libraries) in windows docker container

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. 

A:

This is quite an open-ended question, so it is not possible to give precise answer.  Here are a few thoughts:

This is your program that is missing a dependency.  Presumably, you as the program author should be aware of what dependencies are required.  You need to make sure to include them in your docker image, when you build it. 
You are creating your image based on Windows Core, which does not have the whole slew of UI components.  This looks like the most obvious thing that could go wrong, given the symptoms.  So what I would do is try and make sure that your program can run on Windows Core in principle.  Which brings me to the next point. 
The most practical way to troubleshoot, in my opinion, is to remove Docker from the equation.  You want to run your program on Windows Core.  So setup a machine (physical or VM) with Windows Core inside and try to run your program there.  There is a good chance that it won't run with the same symptoms.  If that's the case, you now have reduced complexity, because you know that your problem has nothing to do with docker (or not). 
Finally, when you have your Windows Core machine up and running, you might be able to see a message box pop up with the error immediately (even on Core you can run some programs with UI can run, and message boxes are not an uncommon site), and failing that you can run sysinternals procmon/procexp even on Windows Core, so using those to locate missing dependencies could help.  There is also Dependencies. 

Note: by "Windows Core" in this answer I mean Core option of Windows Server

