简体   繁体   English

在ASP.NET Core中构建docker:“无此文件或目录”错误

[英]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. 我正在使用Docker版本3和.Net Core 2.0 Web应用程序。

This is my docker file: 这是我的docker文件:

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 这是我的docker-compose.yml文件

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 我发布了Web应用程序,并从发布的目录运行命令: docker-compose build并出现以下错误

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/. 源似乎指向/ 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. 尝试使用相对路径,然后将其复制到speficif文件夹中,以避免与根文件系统中的内容冲突。

Copy obj/Docker/publish /app

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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