Dan The Man
Dan The Man

Reputation: 1895

Build docker in ASP.NET Core: “no such file or directory” error

I am using docker version 3, and .Net Core 2.0 web application.

This is my docker file:

FROM microsoft/aspnetcore:2.0
ARG source
WORKDIR /app
EXPOSE 80
COPY ${source:-obj/Docker/publish} .
ENTRYPOINT ["dotnet", "DotNetCoreWindowsTest.dll"]

and this is my docker-compose.yml file

version: '3'

    services:
      dotnetcorewindowstest:
        image: dotnetcorewindowstest
        build:
          context: ./DotNetCoreWindowsTest
          dockerfile: Dockerfile
        ports:
          - "3001:80"

I published my web application and from the published directory I run the command: docker-compose build and got the following error

ERROR: Service 'dotnetcorewindowstest' failed to build: 
COPY failed: stat /var/lib/docker/tmp/docker-builder739115341/obj/Docker/publish:
 no such file or directory

any ideas what is the problem?

Upvotes: 2

Views: 2003

Answers (1)

herm
herm

Reputation: 16305

COPY ${source:-obj/Docker/publish} .

The source seems to be pointing to /var/lib/docker/tmp/docker-builder739115341/. Try the using a relative path instead and copy it into a speficif folder to avoid conflicts with whatever is in the root filesystem.

Copy obj/Docker/publish /app

Upvotes: 3

Related Questions