Docker Unable to load the service index for source https://api.nuget.org/v3/index.json

Posted 人本善良

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了Docker Unable to load the service index for source https://api.nuget.org/v3/index.json相关的知识,希望对你有一定的参考价值。

解决 Docker Unable to load the service index for source https://api.nuget.org/v3/index.json 问题

在部署jenkins的netcore项目时,使用git中拉取的netcore项目,报错了如下图

我在jenkins里面写的脚本是

docker build --tag jenkinstest:${BUILD_NUMBER} .

一开始以为是网络ping不通,后来发现服务器自接可以wget这个json文件,排除这一可能

研究后发现是docker容器内无法连接外网

把语句改为以下即可

docker build --tag jenkinstest:${BUILD_NUMBER} . --network=host

以上是关于Docker Unable to load the service index for source https://api.nuget.org/v3/index.json的主要内容,如果未能解决你的问题,请参考以下文章