简体   繁体   中英

Running .exe in docker locally

I have a very small .net console application,

 static void Main(string[] args)
        {
            Console.WriteLine("This is testing!");
            Console.ReadLine();
        }

The path structure is like this C:\Kubernetes\src\Sample\bin\Release \debug

My project, dockerfile and sln file are all inside the sample folder

My dockerfile looks like this,

FROM mcr.microsoft.com/windows/servercore:ltsc2016
ADD . /bin/Release
ENTRYPOINT Sample.exe

I build the image successfully using the following command,

docker build . -t samplekube:local

When I try to run the image locally

docker run samplekube:local

I get the following error,

'Sample.exe' is not recognized as an internal or external command,
operable program or batch file.

How do I test an image that contains an.exe in the docker locally?

Thanks

Hi I am not familiar with .net but Execution is complaining about Sample.exe is not found. You're placing the file in /bin/Release directory in the Dockerfile. So having this line would make more sense: ENTRYPOINT /bin/Release/Sample.exe

And also the directory path is containing unix like directory path eventhough the base image is windows server so I think the error must have come from one of those things i mentioned.

I advice you to execute shell on the Entry point to enter the container and find the location of the file

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM