解决 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

猜你喜欢

转载自www.cnblogs.com/Jackyye/p/12587464.html
今日推荐