cannot find the file specified for containers in windows

Viewed 486

I'm new to docker, sorry if my question is too basic, below is my dockerfile:

FROM mcr.microsoft.com/dotnet/core/aspnet:3.1

COPY dist /app

WORKDIR /app

EXPOSE 80/tcp

ENTRYPOINT ["dotnet", "ExampleApp.dll"]

I got an error:

"exampleApp encountered an error during CreateProcess: failure in a Windows system call: The system cannot find the file specified."

So I created an image and start an instance, it was running OK.

But when I try to copy a file to the container:

docker cp ./Views/Home/Index.cshtml exampleApp:/app/Views/Home/ there is a "no such directory" error in powershell, then I ran docker diff exampleApp to see the file system, I couldn't find the app directory in the container: enter image description here

bur I did specify app as working directory inside the container, so why this folder is not appearing in the container?

1 Answers

For a Docker images for ASP.NET Core, I would add to your Dockerfile right after the COPY line:

RUN dir . /s /b sortorder:N

Just to make sure what has been copied, and if the /app/Views/Home/ does indeed exist.

Related