首页 > 其他分享 >dockerfile中nuget源加载失败Retrying 'FindPackagesByIdAsync' for source 'xxx'

dockerfile中nuget源加载失败Retrying 'FindPackagesByIdAsync' for source 'xxx'

时间:2024-10-17 23:23:42浏览次数:1  
标签:RUN xxx apt FindPackagesByIdAsync nuget Mvc dotnet

问题描述:最近jenkins打包总是提示微软源加载不到

Retrying 'FindPackagesByIdAsync' for source 'https://api.nuget.org/v3-flatcontainer/microsoft.extensions.primitives/index.json'.
An error occurred while sending the request.

解决方案:dockerfile中添加国内源,改用华为源就哦了,完整dockerfile文件如下:

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

FROM mcr.microsoft.com/dotnet/aspnet:6.0 AS base
#RUN sed -i 's@/archive.ubuntu.com/@/mirrors.aliyun.com/@g' /etc/apt/sources.list
RUN sed -i '[email protected]@mirrors.ustc.edu.cn@g' /etc/apt/sources.list
RUN apt-get clean
RUN apt-get update
RUN apt-get -y install fonts-wqy-zenhei && apt-get clean &&  fc-cache -fv
WORKDIR /app
EXPOSE 8888

FROM mcr.microsoft.com/dotnet/sdk:6.0 AS build
WORKDIR /src
COPY ./ /src
RUN dotnet nuget remove source nuget.org
RUN dotnet nuget add source https://repo.huaweicloud.com/repository/nuget/v3/index.json -n hw_nuget
RUN dotnet restore "./xxx.Mvc/xxx.Mvc.csproj"
COPY . .
WORKDIR "/src/xxx.Mvc/."
RUN dotnet build "xxx.Mvc.csproj" -c Release -o /app/build

FROM build AS publish
RUN dotnet publish "xxx.Mvc.csproj" -c Release -o /app/publish

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

 

标签:RUN,xxx,apt,FindPackagesByIdAsync,nuget,Mvc,dotnet
From: https://www.cnblogs.com/wangbg/p/18473292

相关文章

  • sudo: unable to resolve host xxxx: Name or service not known
    前言在 Linux 环境中,我使用 sudo 执行命令,发生报错:sudo:unabletoresolvehostxxxx:Nameorservicenotknown解决这个错误通常发生在更改主机名后,使用 sudo 命令时出现问题。sudo 命令会尝试解析主机名,但如果无法解析,就会出现"sudo:unabletoresolvehost"的错......
  • The instance of entity type 'xxx' cannot be tracked because another instance wit
    发生的原因,在CheckProductionCode()方法中根据主键id查询对象时没有使用AsNoTracking(),示例:_db.Productions.AsNoTracking()那么EF会把查询出的对象缓存并跟踪对象状态,之后再Update的时候就会查询现有已跟踪的对象,发现已经存在一个相同主键的对象,所以报错。///<summary>///......
  • qt5报错无法枚举xxx字体:qt.qpa.fonts: Unable to enumerate family ' "WenYue XinQing
    问题描述:使用qt5时,出现错误提示:qt.qpa.fonts:Unabletoenumeratefamily'"WenYueXinQingNianTi(Non-CommercialUse)"'虽然不影响正常使用,但是还是希望解决。猜测:可能是qt5在自动枚举字体时,系统中安装的字体名称过长或其他参数不合规导致qt5无法枚举。如果此字体不是项......
  • 苍穹外卖——报错:Parameter 'xxx' not found. Available parameters are [arg0, colle
    背景:在执行过程中,报错:Servlet.service()forservlet[dispatcherServlet]incontextwithpath[]threwexception[Requestprocessingfailed;nestedexceptionisorg.mybatis.spring.MyBatisSystemException:nestedexceptionisorg.apache.ibatis.binding.Binding......
  • There is no getter for property named ‘xxxxx’ in ‘class com.xxx.xx.xx.xxxx'”
    原文链接:Thereisnogetterforpropertynamed‘xxxxx’in‘classcom.xxx.xx.xx.xxxx’”,–每天进步一点点(longkui.site) 0.背景SpringMVC架构,使用mybatis执行insert语句,然后开始报错:org.mybatis.spring.MyBatisSystemException:nestedexceptionisorg.apache.......
  • node打包报错:ERROR in xxxx.js Module not found: Error: Can’t resolve xxxx in ‘
    原文链接:node打包报错:ERRORinxxxx.jsModulenotfound:Error:Can’tresolvexxxxin‘xxx’errorCommandfailedwithexitcode1.–每天进步一点点(longkui.site) 0.背景anguar项目。分为主包和子包,子包推送到npm私有仓库中,然后主包在packjson中引入子包的版本......
  • git报错:unsafe repository(‘D/xxx/xxx/xx’) To add an exception for this director
    原文链接:git报错:unsaferepository(‘D/xxx/xxx/xx’)Toaddanexceptionforthisdirectory…–每天进步一点点(longkui.site)0.背景电脑重装系统以后,IDEA重新跑起来,然后git拉代码,报错:unsaferepository(‘D/xxx/xxx/xx’)Toaddanexceptionforthisdirectory,call......
  • 泛微e-cology安装报错 MySQL初始化问题Table 'ecology.e9_para_xxx' doestn't exist
    在安装泛微e-cology9进行初始化数据库时出现如下报错Table 'ecology.e9_para_xxx'doestn'texist 明明是在初始化数据库  数据表不存在不是很正常==经过研究  发现泛微在初始化数据库时 会执行存储过程脚本  使用dbeaver可以看到 根据代码逻辑看  如......
  • 2019-3-1-获取-Nuget-版本号
    titleauthordateCreateTimecategories获取Nuget版本号lindexi2019-3-19:27:6+08002019-02-2515:51:48+0800nuget本文告诉大家通过命令行获取Nuget的版本号在Nuget中没有-version和-v和--version等写法,只需要直接输入nuget在第一行就会显示版本号nugetNuGetVers......
  • 修复HTTPS升级后出现 Mixed Content: The page at 'https://xxx' was loaded over HTT
    背景由于需要使用摄像头拍照,需要将原来的http升级到https,通过一顿捣鼓,升级成功。不过页面加载出现了问题,具体的提示是说:你的页面是在https环境,但是你访问了一个资源(我这里是iframe,也可能是stylesheet等其他资源),而这个资源是在http环境下的,浏览器不给你这样玩。https只能访问h......