1.登录总是报错:各种方式尝试,一直以为是网络问题

[root@k8s185 ~]# docker login --username=yshyq registry.cn-hangzhou.aliyuncs.com
Password:
Error response from daemon: Get http://registry.cn-hangzhou.aliyuncs.com/v2/: net/http: request canceled while waiting for connection (Client.Timeout exceeded while awaiting headers)

 

解决:在/etc/resolv.conf添加DNS:8.8.8.8 ,就可以直接用docker login直接登录了

 

其他方式参考:https://www.bbsmax.com/R/WpdKxjqnzV/

 

2.git runner 使用docker模式, 启动的容器, 无法解析域名

git cicd报错信息:

/source-code/src/medpro-aspnet-core/src/GCT.MedPro.Core/GCT.MedPro.Core.csproj : warning NU1801: Unable to load the service index for source http://registry.gct-china.com/repository/nuget-group/index.json. [/source-code/src/medpro-aspnet-core/src/GCT.MedPro.Migrator/GCT.MedPro.Migrator.csproj]

进入docker 容器里 curl registry.gct-china.com显示无法解析

解决办法:

添加dns地址,重启docker

cat /etc/docker/daemon.json 
{  
  "dns": ["192.168.2.3","8.8.8.8"]  
}