简体   繁体   中英

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?
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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM