I asked this exact question on SO as well. However no one has answered yet, so I would like to ask it here once again.
I’m using Windows 10 Enterprise 64bit with Docker desktop for windows installed. It’s used as the host machine (to run the command
docker run). The built image is a Windows-base image (and of course I use Windows container here).
I think this is a problem of deploy path. I have a simple .NET app with no dependencies and need to be deployed in a .NET image built by docker. I put a
Dockerfile in the same folder with that simple .NET app and run the following command to build the image:
docker build --force-rm --no-cache -t test --file=[path_to_docker_file] .
It builds OK. And here is the
FROM microsoft/nanoserver COPY . . ENTRYPOINT test.exe
However when running the following command (to test it):
docker run -rm test
then it says
'test.exe' is not recognized as an internal or external command, operable program or batch file.
I thought that it should have been copied to the image (in the default working folder)? To make it explicit, I’ve also tried another dockerfile like this:
FROM microsoft/nanoserver WORKDIR /app COPY . /app ENTRYPOINT test.exe
So the expected working dir here is
C:\app , but still it’s not working with the same error.
I think this is just trivial to someone familiar with docker, but to me this is just a strange issue (actually dockerizing a .NET core app does not have any similar issue like this, of course for that we use
dotnet to run a dll instead of running the .exe directly in .NET).