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

风格不统一 提交于 2019-12-11 17:35:48

问题


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

来源:https://stackoverflow.com/questions/49580984/c-print-line-not-printing-to-console-in-docker-container

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!