在我构建新的镜像的时候, 发生 了  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 443FROM 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 /appFROM build AS publish
RUN dotnet publish "WebApplication2.csproj" -c Release -o /appFROM 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 80
EXPOSE 443FROM 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 /appFROM build AS publish
RUN dotnet publish "WebApplication3.csproj" -c Release -o /appFROM base AS final
WORKDIR /app
COPY --from=publish /app .
ENTRYPOINT ["dotnet", "WebApplication3.dll"]

转载于:https://www.cnblogs.com/shatanku/p/10827291.html

Visual studio docker build no such file or directory相关推荐

  1. docker build no such file or directory

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

  2. 【Tiny4412】 编译dnw源码报错 /lib/modules/2.6.32-431.el6.x86_64/build/: No such file or directory

    1. 今天编译dnw源码的时候出现如下错误: /lib/modules/2.6.32-431.el6.x86_64/build/: No such file or directory 截图如下: 2. ...

  3. Linux编译遇到各种错误解决方法,例如 /lib/modules/3.10.0-(xxx).el7.x86_64/build: No such file or directory. Stop.

    Linux编译遇到各种错误解决方法,例如: /lib/modules/3.10.0-(xxx).el7.x86_64/build: No such file or directory. Stop. 背 ...

  4. .gitignore for Visual Studio项目和解决方案

    将Git与Visual Studio Solutions( .sln )和Projects结合使用时,我应该在.gitignore包含哪些文件? #1楼 晚到这里聚会,但我也发现我使用以下内容. 有些 ...

  5. Visual Studio 2017中的编译器工具布局

    写在前面 在工作中,偶尔会用到VC编译器.目前,最新版的VS已发布到了2017.其中,微软对于VS的目录结构进行了调整. 该文翻译自微软官方博文 Compiler Tools Layout in Vi ...

  6. 走马观花:Visual Studio Code Name Orcas Mar07CTP /体验DLINQ

    不知道什么叫"Orcas"?简单说应该就是下一版本的Visual Studio 吧. 现在atlas,LINQ,WF之类东西,对于VS2005是单独安装的,Orcas应该是全内置吧 ...

  7. Visual Studio 2010 调试 C 语言程序

    转:http://woyouxian.net/c/using_visual_studio_write_pure_ansi_c_program.html 本篇文章讲述如何用微软的 Visual Stud ...

  8. azure web应用部署_使用Visual Studio Code将Python应用程序部署到Azure Functions

    azure web应用部署 In this article, we are going to build a small python application and deploy it to Azu ...

  9. 使用SQL Server数据工具和Visual Studio Online进行连续部署

    In the previous posts 在以前的帖子中 Deployment to several databases using SQL Server Data Tools and TFS us ...

最新文章

  1. 论COSPLAY / 谨以此文纪念我暂短的Cos生涯
  2. android谷歌补丁日期,在谷歌日历Android中添加开始日期和结束日期之间所有日期的事件...
  3. wxWidgets:wxFocusEvent类用法
  4. Scala _06集合_数组(二)
  5. crontab 每分钟一次_Celery实现定时任务crontab
  6. 设计师更高效_如何丢掉我的工作使我成为一名更好的设计师
  7. leetcode 377. 组合总和 Ⅳ(dp)
  8. 【华为云技术分享】Python 中的异常和错误
  9. java setlayout_Java Button.setLayoutX方法代码示例
  10. 《BI那点儿事》数据流转换——聚合
  11. 建议不要使用Android studio的SVN功能
  12. 敌兵布阵 HDU - 1166(树状数组-模板线段树写法)
  13. (转载)220v交流接触器自锁接线图另接热继电器
  14. golang 结构体使用chan
  15. Google DFP广告管理系统简介:开始与您的网站进行广告集成
  16. win8/win10微信QQ邮箱可登陆,浏览器显示无网络连接
  17. CRM客户关系管理能给企业带来什么样的效果
  18. H5页面自适应各种手机端屏幕分辨率的大小
  19. Android高版本使用DocumentFile读写外置存储的问题
  20. “Spark上流式机器学习算法实现”终期检查报告

热门文章

  1. [SHELL]监控LINUX目录文件变化
  2. IPsec ***基础:认识IPsec ***
  3. javac命令不好用的解决方法
  4. LiveCDLiveUSB制作
  5. wlan bss ess ssid
  6. oracle 分表和分区哪个好_互联网大厂有哪些分库分表的思路和技巧?
  7. Bootstrap自适应居中问题
  8. 面向对象(final/抽象类/接口/内部类)
  9. gulp : 无法加载文件 C:\Users\Administrator\AppData\Roaming\npm\gulp.ps1,因为在此系统上禁止运行脚本
  10. raspberry pi_使用Kubernetes在Raspberry Pi上进行集群计算