首页 > 其他分享 >.NET 5.0 Docker 镜像 错误修复方法

.NET 5.0 Docker 镜像 错误修复方法

时间:2022-10-24 16:34:52浏览次数:73  
标签:5.0 src csproj API Services NET COPY Docker Identity

在给​​eshopondapr​​ 打镜像的时候碰到了3个错误

1、restore: Received an unexpected EOF or 0 bytes from the transport stream: ​​https://github.com/NuGet/Home/issues/9020​

2、Notice: NuGet Restore Failures on Linux distributions using NSS or ca-certificates #10712 :​​https://github.com/NuGet/Home/issues/10712​​ 

3、In .NET Core, libMan install 'Failed to download resource' #476:​​https://github.com/aspnet/LibraryManager/issues/476​​ 

 

解决方法:

1、.NET SDK 更新到​​5.0.202+​​​ 或 ​​升级​​​ ​​.NET 6 Preview 3+​​​  : ​​https://devblogs.microsoft.com/nuget/net-5-nuget-restore-failures-on-linux-distributions-using-nss-or-ca-certificates/ ​

2、添加 --disable-parallel选项: RUN dotnet restore "eShopOnDapr.sln" --disable-parallel

3、运行命令 dotnet tool update --global Microsoft.Web.LibraryManager.Cli

 

#See ​​https://aka.ms/containerfastmode​​​ to understand how Visual Studio uses this Dockerfile to build your images for faster debugging.

ARG NET_IMAGE=5.0-focal

FROM mcr.microsoft.com/dotnet/aspnet:${NET_IMAGE} AS base

WORKDIR /app

EXPOSE 80FROM mcr.microsoft.com/dotnet/sdk:${NET_IMAGE} AS build

WORKDIR /src# Create this "restore-solution" section by running ./Create-DockerfileSolutionRestore.ps1, to optimize build cache reuse

COPY ["src/ApiGateways/Aggregators/Web.Shopping.HttpAggregator/Web.Shopping.HttpAggregator.csproj", "src/ApiGateways/Aggregators/Web.Shopping.HttpAggregator/"]

COPY ["src/BuildingBlocks/EventBus/EventBus/EventBus.csproj", "src/BuildingBlocks/EventBus/EventBus/"]

COPY ["src/BuildingBlocks/EventBus/IntegrationEventLogEF/IntegrationEventLogEF.csproj", "src/BuildingBlocks/EventBus/IntegrationEventLogEF/"]

COPY ["src/BuildingBlocks/WebHost/WebHost.Customization/WebHost.Customization.csproj", "src/BuildingBlocks/WebHost/WebHost.Customization/"]

COPY ["src/Services/Basket/Basket.API/Basket.API.csproj", "src/Services/Basket/Basket.API/"]

COPY ["src/Services/Catalog/Catalog.API/Catalog.API.csproj", "src/Services/Catalog/Catalog.API/"]

COPY ["src/Services/Identity/Identity.API/Identity.API.csproj", "src/Services/Identity/Identity.API/"]

COPY ["src/Services/Ordering/Ordering.API/Ordering.API.csproj", "src/Services/Ordering/Ordering.API/"]

COPY ["src/Services/Payment/Payment.API/Payment.API.csproj", "src/Services/Payment/Payment.API/"]

COPY ["src/Web/WebSPA/WebSPA.csproj", "src/Web/WebSPA/"]

COPY ["src/Web/WebStatus/WebStatus.csproj", "src/Web/WebStatus/"]

COPY ["docker-compose.dcproj", "./"]

COPY ["NuGet.config", "./"]

COPY ["eShopOnDapr.sln", "./"]

RUN dotnet tool update --global Microsoft.Web.LibraryManager.Cli

RUN dotnet restore "eShopOnDapr.sln" --disable-parallelCOPY . .

WORKDIR "/src/src/Services/Identity/Identity.API"

# RUN dotnet build "Identity.API.csproj" -c Release -o /app/buildFROM build AS publish

RUN dotnet publish --no-restore "Identity.API.csproj" -c Release -o /app/publishFROM base AS final

WORKDIR /app

COPY --from=publish /app/publish .

ENTRYPOINT ["dotnet", "Identity.API.dll"]

标签:5.0,src,csproj,API,Services,NET,COPY,Docker,Identity
From: https://blog.51cto.com/shanyou/5790233

相关文章

  • 在WSL2中 安装 .NET Core SDK 进行Linux 开发工作
    安装WSL1、打开WINDOWS功能,勾选子系统选项​​​​2、打开商店搜索WSL,安装ubuntu我这里的系统版本是:18.04如何查看ubuntu系统版本sudolsb_release-a​​​​3、打开ubuntu......
  • Java 生态碎片化 和 .NET生态的一致性
    .NETCore是以MIT协议开源,Java是GPL协议开源。Java8SDK升级Oracle要收费这件事对于很多小公司是有着重大的影响的,Java生态越发碎片化,有众多的OpenJDK发行版,腾讯云和阿里......
  • kubernetes 客户端KubeClient使用及常用api
    KubeClient是kubernetes的C#语言客户端简单易用,KubeClient是.NETCore(目标​​netstandard1.4​​​)的可扩展KubernetesAPI客户端,github地址:​​https://github.com/tin......
  • 为什么 web 开发人员需要迁移到. NET Core, 并使用 ASP.NET Core MVC 构建 web 和 web
    ​​2018.NET开发者调查报告:.NETCore是怎么样的状态​​,这里我们看到了还有非常多的.net开发人员还在观望,本文给大家一个建议。这仅代表我的个人意见,我有充分的理由......
  • Kubernetes--资源注解
    资源注解除了标签(label)之外,Pod与其他各种资源还能使用资源注解(annotation)。与标签类似,注解也是“键值”类型的数据,不过它不能用于标签及挑选Kubernetes对象,仅可用于为资......
  • 群晖安装docker版 onlyoffice
    搭建好OnlyOffice后因为服务是公开的,所以任何人都可以链接使用,就给内存本不就富裕的服务器更大的压力。所以我们需要给OnlyOffice设置好密钥(JWT令牌),只给自己允许的人......
  • ASP.NET 4 AppFabric 输出缓存提供程序
    缓存是用来保存你数据的地方,从而使你的应用程序访问更快速。缓存可以根据你的需要分配到许多台机器上,而开发人员无需关心数据究竟在哪台机器上。为了获得......
  • "Ascend.Net" Windows Forms Controls
    在微软的开源网站上http://www.codeplex.com有一个WinformControl项目Ascend.NET,非常不错.做Winform程序的兄弟可以关注一下.在微软的开源网站上......
  • Netty进阶-黏包半包分析
    Netty进阶1、黏包服务端//测试黏包服务端@Slf4jpublicclassTestNianbaoServer{publicstaticvoidmain(String[]args){NioEventLoopGroupboss=......
  • Netty进阶-黏包半包解决方案
    4、解决方案4.1、短连接以解决黏包为例。服务端同上,客户端如下//短连接处理黏包,发送后关闭publicclassTestSloveNianbaoClient{publicstaticvoidmain(Strin......