本文共 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 如侵犯您的版权,请留言回复原文章的地址,我们会给您删除此文章,给您带来不便请您谅解!