【Docker问题】CentOS安装docker后运行报错Get https://registry-1.docker.io/v2/
发布日期:2021-06-24 15:28:52 浏览次数:2 分类:技术文章

本文共 2069 字,大约阅读时间需要 6 分钟。

整理一下所有遇到这个问题的解决办法,最终已解决!!!!

1、先确定虚拟机能够连接公网,网络适配器选择NAT

[root@localhost etc]# ping www.baidu.comPING www.wshifen.com (103.235.46.39) 56(84) bytes of data.64 bytes from 103.235.46.39 (103.235.46.39): icmp_seq=2 ttl=128 time=117 ms64 bytes from 103.235.46.39 (103.235.46.39): icmp_seq=3 ttl=128 time=80.9 ms64 bytes from 103.235.46.39 (103.235.46.39): icmp_seq=4 ttl=128 time=105 ms64 bytes from 103.235.46.39 (103.235.46.39): icmp_seq=6 ttl=128 time=116 ms

2、如果在拉取镜像时出现如下图报错,考虑先docker login

Error response from daemon: Get https://registry-1.docker.io/v2/: net/http: request canceled while waiting for connection (Client.Timeout exceeded while awaiting headers)

3、如果docker login 报错如下

[root@localhost etc]# docker loginLogin with your Docker ID to push and pull images from Docker Hub. If you don't have a Docker ID, head over to https://hub.docker.com to create one.Username: kaerdockerPassword: Error response from daemon: Get https://registry-1.docker.io/v2/: net/http: request canceled while waiting for connection (Client.Timeout exceeded while awaiting headers)

 4、多数是国外镜像源的网络限制导致,使用国内镜像源即可,但是网络上一大堆没用的,直接上命令

#####https://registry.docker-cn.com是可用的##########

[root@localhost etc]# vim /etc/docker/daemon.json

{
"registry-mirrors":["https://docker.mirrors.ustc.edu.cn","https://registry.docker-cn.com"]
}

#####

[root@localhost etc]# systemctl daemon-reload 

[root@localhost etc]# systemctl restart docker

[root@localhost etc]# docker login

如果报错Error response from daemon: Get https://registry-1.docker.io/v2/: net/http: TLS handshake timeout试着重新寻找镜像源吧

[root@localhost etc]# docker run hello-world

如果以上还不能解决,下面总结下网络搜索下出现的解决方案(本人未使用到)

##########摘抄该链接

mkdir -p /etc/systemd/system/docker.service.d

nano /etc/systemd/system/docker.service.d/http-proxy.conf

[Service]

Environment="HTTP_PROXY="
Environment="HTTPS_PROXY="

systemctl daemon-reload

systemctl restart docker

###########变更DNS###########

[root@localhost etc]# vim /etc/resolv.conf

# Generated by NetworkManager

search localdomain
#nameserver 172.20.10.4

nameserver 8.8.8.8

nameserver 8.8.4.4

结束,继续docker之旅。

 

保存下推荐资源:

 

转载地址:https://blog.csdn.net/weixin_33602978/article/details/105263323 如侵犯您的版权,请留言回复原文章的地址,我们会给您删除此文章,给您带来不便请您谅解!

上一篇:【RPC系列】4、自定义xml标签(用netty、zk手写RPC第一步)
下一篇:【RPC系列】3、序列化技术(必读)

发表评论

最新留言

初次前来,多多关照!
[***.217.46.12]2024年04月26日 00时43分37秒