络腮胡菲菲 发表于 2024-10-8 09:05:23

docker pull 超时Timeout失败的办理办法

当国内开发者docker pull碰到如下提示时,不要惊奇
# docker pull postgres
Using default tag: latest
Error response from daemon: Get "https://registry-1.docker.io/v2/": dial tcp 128.121.146.235:443: i/o timeout
#
自2024-06-06开始,国内的Docker Hub镜像加速器相继不能正常使用,之前配置的
# cat /etc/docker/daemon.json
{
    "registry-mirrors": [
      "https://docker.mirrors.ustc.edu.cn"
    ]
}
不论清华、阿里云、科大、163等等都已失效,或只允许内部访问。
其实有更简单、速度更快的办法,以下是经过亲自测试可行。
一、AtomHub可信镜像中央

由开放原子开源基金会牵头,联合多家行业伙伴发起,遵照OCI(Open Container Initiative,以下简称“OCI”)容器镜像标准,旨在为开发者提供开放中立、安全可信、高效便捷的新一代开源容器镜像中央
特点:国内访问速度快(推荐)

网址:https://hub.atomgit.com

https://i-blog.csdnimg.cn/direct/97a2d0f41c9d4d4ea3058a1c674a6e97.png
例如:搜索本身必要的镜像
https://i-blog.csdnimg.cn/direct/03c595e19e164818add1d7a38985063f.png
然后docker pull hub.atomgit.com/library/postgres:15-alpine3.17
就OK了
二、Chainguard (备用)

Chainguard 是一个专注于提供安全容器镜像的公司,致力于从源头消除 CVE(Common Vulnerabilities and Exposures,通用漏洞和曝光)问题。
特点:镜像文件比力小

https://images.chainguard.dev

https://i-blog.csdnimg.cn/direct/d561bc59645d49e0a67278e87cc41f4f.png
搜索镜像
https://i-blog.csdnimg.cn/direct/7906f105af334289aead39e2d34e4414.png
docker pull cgr.dev/chainguard/postgres
简单对比一下速度

# time docker pull cgr.dev/chainguard/postgres
Using default tag: latest
latest: Pulling from chainguard/postgres
d3f07142fdd6: Pull complete
Digest: sha256:fd46506abb83d63993c08da469434079e792de2c6f5459bbb99fbaecf8cc7835
Status: Downloaded newer image for cgr.dev/chainguard/postgres:latest
cgr.dev/chainguard/postgres:latest

real        0m57.700s
user        0m0.019s
sys        0m0.011s

# time docker pull hub.atomgit.com/library/postgres:15-alpine3.17
15-alpine3.17: Pulling from library/postgres
ee4b481db132: Pull complete
c701bdac6d5c: Pull complete
efb481014518: Pull complete
7a8407cb3541: Pull complete
f5dd2441c6c6: Pull complete
980832abee30: Pull complete
859d0db327f6: Pull complete
b00939ae8502: Pull complete
Digest: sha256:1a6fab51c426cf01602f93cc13767f92fc333f0a7e598ac6d0640840144ea8b2
Status: Downloaded newer image for hub.atomgit.com/library/postgres:15-alpine3.17
hub.atomgit.com/library/postgres:15-alpine3.17

real        0m8.241s
user        0m0.012s
sys        0m0.011s
# docker images
REPOSITORY                         TAG             IMAGE ID       CREATED         SIZE
cgr.dev/chainguard/postgres      latest          47473ce3dbef   11 hours ago    100MB
hub.atomgit.com/library/postgres   15-alpine3.17   ed93f48a4bd9   10 months ago   248MB
ChainGuard 拉取的镜像体积较小,仅100MB,但必要57秒;
而开放原子开源基金会 AtomHub 提供的镜像体积约为250MB,仅需8秒。
https://i-blog.csdnimg.cn/direct/a70dd5022b8f4330ae3757aadac1001e.png
最后,我要特殊感谢开放原子开源基金会 AtomHub 的成员单位,他们为开发者做出的贡献是值得歌颂的。

免责声明:如果侵犯了您的权益,请联系站长,我们会及时删除侵权内容,谢谢合作!更多信息从访问主页:qidao123.com:ToB企服之家,中国第一个企服评测及商务社交产业平台。
页: [1]
查看完整版本: docker pull 超时Timeout失败的办理办法