C++ print line not printing to console in Docker c

2019-08-20 04:58发布

问题:

I've got a very basic proof-of-concept C++ application, shown below:

#include <iostream>

int main()
{
    std::cout << "test" << std::endl;
    return 0;
}

When this is run locally, it prints test to the Console, as expected. However, when run on a Docker container, nothing is printed.

I'm using the microsoft/windowsservercore as for my container. Since this is still proof-of-concept, my Dockerfile consists of copying the exe of my C++ into the image, and then I'm manually running it interactively.

Am I missing something that prevents C++ applications from printing to the console inside of a Windows Docker image?

Dockerfile:

FROM microsoft/windowsservercore
COPY ./Resources /

Resources folder contains only the exe of the C++ application

Docker command: docker run --rm -it proofconcept:latest, where proofconcept is the name given during build