首页
学习
活动
专区
圈层
工具
发布
首页
学习
活动
专区
圈层
工具
MCP广场
社区首页 >专栏 >.NET 5.0 Docker 镜像 错误修复方法

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

作者头像
张善友
发布2021-07-14 15:31:38
发布2021-07-14 15:31:38
1.4K0
举报
文章被收录于专栏:张善友的专栏张善友的专栏

在给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+

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 80

FROM 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-parallel

COPY . . WORKDIR "/src/src/Services/Identity/Identity.API" # RUN dotnet build "Identity.API.csproj" -c Release -o /app/build

FROM build AS publish RUN dotnet publish --no-restore "Identity.API.csproj" -c Release -o /app/publish

FROM base AS final WORKDIR /app COPY --from=publish /app/publish . ENTRYPOINT ["dotnet", "Identity.API.dll"]

本文参与 腾讯云自媒体同步曝光计划,分享自作者个人站点/博客。
原始发表:2021-07-09 ,如有侵权请联系 cloudcommunity@tencent.com 删除

本文分享自 作者个人站点/博客 前往查看

如有侵权,请联系 cloudcommunity@tencent.com 删除。

本文参与 腾讯云自媒体同步曝光计划  ,欢迎热爱写作的你一起参与!

评论
登录后参与评论
0 条评论
热度
最新
推荐阅读
目录
  • 1、restore: Received an unexpected EOF or 0 bytes from the transport stream: https://github.com/NuGet/Home/issues/9020
领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档