GetFileAttributesEx <file>: The system cannot find the path specified

Hello,

I am trying to build an image for a simple .NET Core 1.0 application over microsoft/dotnet:nanoserver-runtime image.
My Dockerfile is as following:

FROM microsoft/dotnet:nanoserver-runtime
COPY CoreConsoleApp1.dll /app/
WORKDIR /app
CMD [ "cmd" ]

When I am executing a following line from a folder that contains the above Dockerfile and CoreConsoleApp1.dll files:

docker build .

I get the following error:

GetFileAttributesEx CoreConsoleApp1.dll: The system cannot find the path specified.

Please, advise what this docker wants from me?! :slight_smile:

Apparently, the issue was with a misconfigured (by VS2017 RC) .dockerignore file. The error message is simply misleading. Once the file was removed, the COPY operation worked as expected

To expand on this a bit more, I had this issue and found through this post that .dockerignore was the culprit. Instead of deleting the file, though, I modified it to read like this, adding the last line to what VS2017 generated for me:

*
!obj/Docker/publish/*    
!obj/Docker/empty/
!bin/Release/PublishOutput/*

I’m new to all this, but I read this as “don’t let docker use anything in this folder, EXCEPT the three folders below”. Note the Dockerfile still controls which files get copied to the image, so modifying this (as I understand it), only allows for the possibility of /bin/Release/PublishOutput to be copied to the image. The relevant line on my Dockerfile looks like this:

COPY ${source:-bin/Release/PublishOutput} .

This allows creating an image from the contents of that folder, instead of the contents of obj/Docker/publish.

Limit the data size of the project folder is useful since it minimizing the size of the context data being sent to docker host on docker build command. I had to dealt with that while showing PoC on using Docker integration with VS. I am personally prefer to build containers separately from VS because the integration is inflexible and create a lot of redundant stuff on docker host (e.g. additional images and not removing container instances).