返回信息流Kernel Version: 4.18.0-305.3.1.el8.x86_64
Operating System: CentOS Linux 8
OSType: linux
Architecture: x86_64
CPUs: 56
Total Memory: 502.3GiB
Name: 192-168-24-44
ID: OD5S:LYAW:XL73:L7IY:6H5Y:VHLY:IUDE:YS5P:X67H:QEYV:ZRAP:XMRG
Docker Root Dir: /var/lib/docker
Debug Mode: false
Registry: https://index.docker.io/v1/
Labels:
Experimental: false
Insecure Registries:
127.0.0.0/8
Registry Mirrors:
https://ustc-edu-cn.mirror.aliyuncs.com/
Live Restore Enabled: false
这是一条镜像帖。来源:北邮人论坛 / linux / #160651同步于 2022/5/19
该镜像源已超过 30 天没有更新,可能在源站已被删除。
Linux机器人发帖
docker的index https://index.docker.io/v1/源可以替换吗
zithersw
2022/5/19镜像同步3 回复
订阅后,新回复会通过你的通知中心匿名送达。
3 条回复
You may
https://github.com/docker/docker-ce/blob/8bb27fc680463da975f386e3a325fe4d52b05f8e/components/engine/registry/config.go#L29
大神你好,公司内网环境,好不容易申请开通了到
https://ustc-edu-cn.mirror.aliyuncs.com/
http://hub-mirror.c.163.com/
的网络策略,但是pull镜像的时候还是不行:
docker pull hub-mirror.c.163.com/library/nginx:latest
即便是这样指定的url也还是不行,而且我确认到hub-mirror.c.163.com的策略是通的。
daemon.json的配置如下:
{
"registry-mirrors": [
"https://ustc-edu-cn.mirror.aliyuncs.com",
"http://hub-mirror.c.163.com"
],
"insecure-registries":[
"hub-mirror.c.163.com"
],
"debug":true,
"experimental":false
}
我在一个自己的虚拟机上这样配置和直接执行上述的pull是可以的。
【 在 FredericDT 的大作中提到: 】
: You may
: https://github.com/docker/docker-ce/blob/8bb27fc680463da975f386e3a325fe4d52b05f8e/components/engine/registry/config.go#L29
【 在 zithersw 的大作中提到: 】
: 大神你好,公司内网环境,好不容易申请开通了到
: https://ustc-edu-cn.mirror.aliyuncs.com/
: http://hub-mirror.c.163.com/
: ...................
我对 daemon.json 进行了 proof of work 验证,具体工作方法在本文底部。
猜测,可能仍然是贵司网络策略导致。
这里提供一个排障思路:
根据 https://docs.docker.com/registry/spec/api/
可以 curl http://hub-mirror.c.163.com/v2/ 对 registry 的可达性进行测试。
参考下图
根据我运维 registry 的经验,给你提供 registry 服务的 endpoint 可能不止 hub-mirror.c.163.com 这个 host。registry 可以在向你提供 manifest 时引导 docker client 前往其他对象存储 pull 真正的 image tar。
这里我以 dig 查询 hub-mirror.c.163.com 的 A 记录:
可见该 domain 并不存在 value 为 45.127.129.36 的 A 记录。这个 IP 层 addr 的来源参考下文。
所以我认为 hub-mirror.c.163.com 应用到了我上述的特性,你需要进一步申请可达策略。
下面是我排除 daemon.json 干扰的工作流程:
Proof of Work,下面描述的 A、B、C 处见图1
1. 拷贝你提供的 daemon.json,如 C 处所示
2. systemctl restart docker
3. sudo docker pull hub-mirror.c.163.com/library/nginx:latest,如 B 处所示
4. sudo tcpdump -i eth0 -n -vvvv 'tcp and port 80',如 A 处所示
图1
我的发行版为 Debian GNU/Linux 11 (bullseye),所用 docker 组件版本为 Docker version 20.10.5+dfsg1, build 55c4c88
对于 45.127.129.36 这个地址,根据 https://bgp.he.net/ip/45.127.129.36 可知,该地址段 45.127.128.0/22 由 AS45062 宣告,描述为 "Guangzhou NetEase Computer System Co., Ltd"。
可以推断,我确实成功从 container registry "hub-mirror.c.163.com" pull 了 library/nginx:latest 的 image。
分析 PoW 可知你的 daemon.json 配置可以 work,排除该部分在我这个版本下的配置错误的问题。猜测:在其他相近的版本号也应当能 work。
此刻我推断,可能仍然是贵司网络策略导致。
==
最后给你提供一个附录
Configuring a registry
https://docs.docker.com/registry/configuration/#storage
==
希望能节省你几小时的人生