人本善良

导航

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

posted on 2020-10-28 15:10  简简单单2018  阅读(1435)  评论(1编辑  收藏  举报