Docker Community Forums

Share and learn in the Docker community.

Cannot run a windows c++ application in docker for windows


(Dockerforguoc) #1

hi,everyone, i want to move a WIN32 application to docker container, i tried several days but i even can not to get a simpal HelloDocker c++ application running in a conatiner, so please help me

Simple command line application that outputs a string, i tried both VS2010 and VS2015:
#include “stdafx.h”
#include
#include
using namespace std;
int _tmain(int argc, _TCHAR* argv[])
{
printf(“hello,docker”);
return 0;
}

A simple Dockerfile:
FROM microsoft/nanoserver:10.0.14393.2068_zh-cn
COPY . /test
WORKDIR /test
RUN powershell.exe -Command Start-Process vc_redist.x64.exe -ArgumentList ‘/quiet’ -Wait
RUN powershell.exe -Command Start-Process vc_redist.x86.exe -ArgumentList ‘/quiet’ -Wait
RUN powershell.exe -Command Start-Process vcredist2010_x86.exe -ArgumentList ‘/quiet’ -Wait
RUN powershell.exe -Command Start-Process vcredist2010_x64.exe -ArgumentList ‘/quiet’ -Wait
RUN powershell.exe -Command Start-Process VC_x86Runtime.exe -ArgumentList ‘/quiet’ -Wait
CMD test.exe

when i run the image, i get nothing, there is no “hello,docker” or any error infomation

can anyone help me ? thanks advance.


(Sam) #2

what are those?

RUN happens at docker BUILD time, not at docker RUN time.


(Raj Chaudhuri) #3

Does docker logs show anything?

What else is there in the test directory that gets copied into the image?


(Dockerforguoc) #4

thanks everyone, the problem has been resolved, my image is based on nanoserver which only supports 64 bit applications, so i built a 64 bit application ,then it worked


(Viswaprakash) #5

Hi All,

I’m having the same problem, but I can’t built my application as 64-bit. So please help me to resolve this problem.

i want to move a WIN32 application to docker container, i tried several days but i even can not to get a simpal HelloDocker c++ application running in a conatiner


(Dockerforguoc) #6

The nanoserver image only supports 64-bit application, so you can try your application on windowsservercore image, but this image is too huge


(Viswaprakash) #7

Is windowsservercore image supports 32 bit application?


(Dockerforguoc) #8

yes i remembered that i see it on the offical documation , but the image is too huge,about 10G


(Viswaprakash) #9

Im newbie to docker, im creating project in VS2017 and it uses nano server by default. Can you please let me know how to change to windowservercore images. Actually Im running the C++ application inside asp.net core application.

By default below container is used in VS2017,
FROM microsoft/aspnetcore:2.0-nanoserver-1709 AS base


(Dockerforguoc) #10

You can change the base image, why not chose the windowsservercore image?


(Viswaprakash) #11

There is no option in VS to choose the base image. Now I using like microsoft/windowsservercore AS base this but it is not pulling. For long time it shows pulling fs layer.


(Viswaprakash) #12

I have successfully installed windowsservercore image, but it does not has asp.net core. So I am unable to check the x86 c++ application.

Im started the application inside my aspdotnetcore project. please let me know how to install aspnetcore on the image. Or suggest me some image with aspnetcore - windowservercore .


(Jianghong123) #13

I met the same problem,but i can not solve. can you send me the project to my e-mail:1456098533@qq.com. I run the project in win10 docker for windows.