在我构建新的镜像的时候, 发生 了  no such file or directory 的错误。  这个错误找了半天, 没头绪,项目结构是这样的:

WebApplication1 建立在根目录下,是可以release构建成功的,而WebApplication2是建立在根目录下的src目录下面的,release 构建执行到step8的时候就抛出no such file or directory 错误了,

dockerfile 文件如下:

FROM microsoft/dotnet:2.2-aspnetcore-runtime AS base
WORKDIR /app
EXPOSE 80
EXPOSE 443 FROM microsoft/dotnet:2.2-sdk AS build
WORKDIR /WebApplication6/src
COPY ["src/WebApplication2/WebApplication2.csproj", "src/WebApplication2/"]
RUN dotnet restore "src/WebApplication2/WebApplication2.csproj"
COPY . .
WORKDIR "/WebApplication6/src/WebApplication2"
RUN dotnet build "WebApplication2.csproj" -c Release -o /app FROM build AS publish
RUN dotnet publish "WebApplication2.csproj" -c Release -o /app FROM base AS final
WORKDIR /app
COPY --from=publish /app .
ENTRYPOINT ["dotnet", "WebApplication2.dll"]

  项目结构如下:

仔细排查得知,原来是dockerfile 的workdir设定问题,最终结果如下:

FROM microsoft/dotnet:2.2-aspnetcore-runtime AS base
WORKDIR /app
EXPOSE
EXPOSE FROM microsoft/dotnet:2.2-sdk AS build
WORKDIR /WebApplication6/src
COPY ["WebApplication3/WebApplication3.csproj", "WebApplication3/"]
RUN dotnet restore "WebApplication3/WebApplication3.csproj"
COPY . .
WORKDIR /WebApplication6/src/WebApplication3/
RUN dotnet build "WebApplication3.csproj" -c Release -o /app FROM build AS publish
RUN dotnet publish "WebApplication3.csproj" -c Release -o /app FROM base AS final
WORKDIR /app
COPY --from=publish /app .
ENTRYPOINT ["dotnet", "WebApplication3.dll"]

Visual studio docker build no such file or directory的更多相关文章

  1. docker build no such file or directory

    在我构建新的镜像的时候, 发生 了  no such file or directory 的错误.  这个错误找了半天, 没头绪, 后来灵光一现, 原来是我的文件夹名字写错了 我的目录结构是这样的 [ ...

  2. docker 解决:Get http:///var/run/docker.sock/v1.19/version: dial unix /var/run/docker.sock: no such file or directory. Are you trying to connect to a TLS-enabled daemon without TLS?

    docker 安装之后,通过命令查看docker相关信息时,可能会出现错误:Get http:///var/run/docker.sock/v1.19/version: dial unix /var/ ...

  3. Visual Studio 中 Build 和 Rebuild 的区别

    因为之前写的程序比较小,编译起来比较快,所以一直都没有太在意 Build 和 Rebuild 之间的区别,后来发现两个还是有很大不同. Build 只针对在上次编译之后更改过的文件进行编译,在项目比较 ...

  4. Visual studio每次build自动增加版本号

    关键词:visual studio,rc file,VS_VERSION_INFO,FILEVERSION,PRODUCTVERSION 目标:希望每次在vs中编译项目时,生成的可执行程序版本号自动+ ...

  5. Windows下用Visual Studio来build ImageMagick

    参考: http://www.imagemagick.org/script/install-source.php#windows http://blog.163.com/anteaus_20/blog ...

  6. Visual Studio 中 Build、Rebuild 、 Clean 之间的区别是什么?

    今天翻看c-sharpcorner技术网站看到了这样一篇小记,标题为:What Is The Difference Between Build, Rebuild And Clean In Visual ...

  7. Visual Studio Docker调试端口设置

    一.前言 在Visual Studio 调试程序时,Docker中的容器端口和主机端口映射随机生成,导致每次调试都需要修改前端API接口的地址 二.解决方案 1.修改Docker调试启动参数,找到启动 ...

  8. Linux,Docker,Jenkins No such file or directory

    你们先休息下,我先哭哭! 今天在做交接项目的bug修改的时候,在创建文件的时候报错 No such file or directory 然后跟着路径去linux中查看了该路径,但确实存在,并且权限都是 ...

  9. Use Visual studio 2010 build Python2.7.10

    http://p-nand-q.com/python/building-python-27-with-vs2010.html

随机推荐

  1. Reload file in vim

    68down voteaccepted Give this a try: :e From :h :e: Edit the current file. This is useful to re-edit ...

  2. CentOS 7.0安装Zimbra 8.6邮件服务器

    Zimbra的核心产品是Zimbra协作套件(Zimbra Collaboration Suite,简称ZCS). 系统:Centos7 ip地址:192.168.127.131 安装前准备 1.关闭 ...

  3. leetCode 67.Add Binary (二进制加法) 解题思路和方法

    Given two binary strings, return their sum (also a binary string). For example, a = "11" b ...

  4. 系统队列中的Windows错误报告

  5. 基于字符的打印机 图形化打印机 PostScript解释器

    60行*80字符/行=4800字节 300点/英寸(300DPI)   8*10英寸/页打印区域 光栅图像处理器  RIP PostScript程序--- > PostScript解释器 --& ...

  6. HTTP要点概述:三,客户端和服务器,请求和响应

    一,客户端和服务器: HTTP协议主要用于客户端和服务器之间的通信. 1,客户端(client):请求访问资源的一端.(知道为啥用C表示客户端了吧) 2,服务器(server):提供资源响应的一端. ...

  7. RabbitMQ的远程Web管理与监控工具

    RabbitMQ提供了完善的管理和监控工具,分management plugin 和 rabbitmqctl 两种类型的工具. 1.management plugin  rabbitmq-manage ...

  8. 一步一步学Silverlight 2系列(4):鼠标事件处理

    一步一步学Silverlight 2系列(4):鼠标事件处理   概述 Silverlight 2 Beta 1版本发布了,无论从Runtime还是Tools都给我们带来了很多的惊喜,如支持框架语言V ...

  9. Go语言web框架 gin

    Go语言web框架 GIN gin是go语言环境下的一个web框架, 它类似于Martini, 官方声称它比Martini有更好的性能, 比Martini快40倍, Ohhhh….看着不错的样子, 所 ...

  10. Wait示例分析

    wait方法使"当前线程"进入阻塞(等待)状态. 示例分析: public class TestWait { public static void main(String[] ar ...