I have a simple c# console app:
static void Main(string[] args)
{
Console.WriteLine("TESTING!");
Console.ReadLine();
}
and a DockerFile:
FROM microsoft/windowsservercore
WORKDIR /app
COPY /bin/Debug .
ENTRYPOINT ["dotnet","TestApp.exe"]
I've built an image:
docker build -f dockerfile -t testapp .
Then I try and run it:
docker run testapp
Which gives this error:
C:\Program Files\Docker\Docker\Resources\bin\docker.exe:
Error response from daemon: container a728cbed9188640df1d6e2f5c4d75f3ae3faef6162ec978575f9a587ed6546eb encountered an error during CreateProcess:
failure in a Windows system call:
The system cannot find the file specified. (0x2) extra info:
{"CommandLine":"dotnet TestApp.exe","WorkingDirectory":"C:\\app","CreateStdInPipe":true,"CreateStdOutPipe":true,"CreateStdErrPipe":true,"ConsoleSize":[0,0]}.
Is it TestApp.exe which it can't find?
First publish the console application. Use the below docker file -
FROM microsoft/windowsservercore
ADD publish/ /
ENTRYPOINT TestApp.exe
The first line in the Dockerfile designates the base image using the FROM instruction. Next, ADD in the file copies the application assets from the publish folder to root folder of the container and last; setting the ENTRYPOINT of the image states that this is the command or application that will run when the container starts.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With