Docker pull镜像一直在Waiting无法下载,根本解决方法

000X000 2024-06-17 11:07:03 阅读 94

1、现象描述:

docker pull 拉去镜像一直在等待,无法下载,最后失败如下:

[root@localhost docker]# docker pull zookeeperUsing default tag: latestlatest: Pulling from library/zookeeper2ec76a50fe7c: Retrying in 1 secondfab7f202453a: Retrying in 1 secondee59ca42def8: Retrying in 1 second2ce2282f972f: Waitingd2a9e456ba82: Waitingb59edc04016d: Waiting1e52b217ebb4: Waiting7a5027dbe828: Waiting4f4fb700ef54: Waiting8e018b2f6fcb: Waitingerror pulling image configuration: download failed after attempts=6: dial tcp 199.59.148.246:443: connect: connection refused

2、现象分析:

经排查分析:

       原因1:服务器DNS无法解析       原因2:docker 源有问题

3、解决方法:

3.1、配置并更新DNS

以CentOS7为例,直接操作哦:

vi /etc/sysconfig/network-scripts/ifcfg-eth0DNS1=223.5.5.5DNS2=223.6.6.6vi /etc/resolv.confnameserver 223.5.5.5nameserver 223.6.6.6nameserver 8.8.8.8systemctl restart network###测试一下 是否联通ping 223.5.5.5

3.2、更新docker源,换成国内源

sudo mkdir -p /etc/dockersudo tee /etc/docker/daemon.json <<-'EOF'{ "registry-mirrors": ["https://mirror.ccs.tencentyun.com/"]}EOFsudo systemctl daemon-reloadsudo systemctl restart docker

3.3、同步时间

####需安装ntp, 自行搜ntpdate ntp1.aliyun.com

4、结果如下,6得很:

[root@localhost docker]# docker pull zookeeperUsing default tag: latestlatest: Pulling from library/zookeepera2abf6c4d29d: Pull complete2bbde5250315: Pull complete202a34e7968e: Pull complete4e4231e30efc: Pull complete707593b95343: Pull completeb070e6dedb4b: Pull complete46e5380f3905: Pull complete8b7e330117e6: Pull completeDigest: sha256:2c8c5c2db6db22184e197afde13e33dad849af90004c330f20b17282bcd5afd7Status: Downloaded newer image for zookeeper:latestdocker.io/library/zookeeper:latest



声明

本文内容仅代表作者观点,或转载于其他网站,本站不以此文作为商业用途
如有涉及侵权,请联系本站进行删除
转载本站原创文章,请注明来源及作者。