asp.net - docker build 失败并显示以下消息
问题描述
[build-env 5/7] RUN dotnet restore:
#12 1.506 Determining projects to restore...
#12 48.75 /usr/share/dotnet/sdk/5.0.401/NuGet.targets(131,5): error : Unable to load the service index for source https://api.nuget.org/v3/index.json. [/app/OptimizerContainerAPI.csproj]
#12 48.75 /usr/share/dotnet/sdk/5.0.401/NuGet.targets(131,5): error : The SSL connection could not be established, see inner exception. [/app/OptimizerContainerAPI.csproj]
#12 48.75 /usr/share/dotnet/sdk/5.0.401/NuGet.targets(131,5): error : The remote certificate is invalid because of errors in the certificate chain: PartialChain [/app/OptimizerContainerAPI.csproj]
以下是我的 Dockerfile 中的片段
#Get base image for the .Net Core from Microsoft
FROM mcr.microsoft.com/dotnet/sdk:5.0 as build-env
WORKDIR /app
#copy the CSPROJ files and restore any dependicies
COPY *.csproj ./
COPY NuGet.Config ./
RUN dotnet restore
#Copy the project files and build our release
COPY . ./
RUN dotnet publish -c Release -o out
#Generate Runtime image
FROM mcr.microsoft.com/dotnet/aspnet:5.0
WORKDIR /app
EXPOSE 80
COPY --from=build-env /app/out .
ENTRYPOINT [ "dotnet", "OPTIMIZERCONTAINERAPI.dll"]
解决方案
推荐阅读
- r - 使用循环加载多个数据集 r
- java - Mac Os Catalina 阻止 jar 应用程序进入文件夹
- mysql - 返回当前或下周末的结果
- python - 使用不受欢迎的 pyproject.toml 作者更改 Python 诗歌初始化新项目
- android - 如何使用 MAC 在真正的 android 设备上测试应用程序
- python-3.x - condition statements in pandas
- c# - 将属性名称作为参数传递
- android - 存根方法时获取 InvalidUseOfMatchersException
- javascript - 将 node.js postgres 查询结果保存在变量中
- javascript - 在 Sequelize 中播种时出现验证错误