dockerdockerfileriderrun-configuration

Docker configuration does not find existing file?


I try to configure and run a docker file in IntelliJ Rider.

During the build, I get the following error:

Step 7/17 : COPY ["src/No.Services/No.Gf/No.Gf.Api/No.Gf.Api.csproj", 
"src/No.Services/No.Gf/No.Gf.Api/"]
Error response from daemon: COPY failed: file not found in build context or excluded by .dockerignore: 
stat src\No.Services\No.Gf\No.Gf.Api\No.Gf.Api.csproj: file does not exist

The file is right where the path points to. It's not exluded in .dockerignore.

I am out of options here?

Step 6 is:

Step 6/17 : WORKDIR /src

Maybe this is adding one "/src" to much and in step 7 it's finally looking for the file in /src/src/...?


Solution

  • I don't know your physical directory hierarchies, but I would say that the reason of the error may be the original relative path between the Dockerfile and the csproj. With the csproj location stated like src/No.Services/No.Gf/..., the Dockerfile will have to be at the same level of that src folder, for the copy to be successful.

    Could you please verify this?

    (If you are working with a typical dotnet solution on top of the project, setting the Dockerfile in the root of the solution may solve your error, since it will respect the folders' hierarchy.)

    Regarding the other topics: