橦言无忌

一个不想改变世界的程序媛

docker speedup list

前言

当前可用的docker镜像源汇总~

go on~

线上结果

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
====== 测试结果 (按速度排序) ======
1. 中科院软件所 https://mirror.iscas.ac.cn 100.89 ms
2. dao https://docker.m.daocloud.io 151.79 ms
3. 阿里云 https://registry.aliyuncs.com 223.61 ms
4. 1ms https://docker.1ms.run 226.38 ms
5. kejilion https://docker.kejilion.pro 432.21 ms
6. kubesre https://dhub.kubesre.xyz 694.82 ms
7. hl https://docker.hlmirror.com 945.44 ms
8. tbedu https://docker.tbedu.top 983.37 ms
9. cloudlayer https://image.cloudlayer.icu 1023.68 ms
10. xuanyuan https://docker.xuanyuan.me 1033.38 ms
11. docker0 https://docker-0.unsee.tech 1065.98 ms
12. sunzi https://docker.sunzishaokao.com 1069.39 ms
13. rundocker https://run-docker.cn 1149.84 ms
14. crdz https://hub.crdz.gq 1414.2 ms
15. meli https://docker.melikeme.cn 2700.74 ms

使用

临时

直接使用,直接拿镜像域名拼接上官方镜像名,例如要拉去镜像 istio/distroless,可以用下面写法(不要带 https://)

1
docker pull docker-0.unsee.tech/istio/distroless

永久配置

修改文件 /etc/docker/daemon.json(如果不存在则需要创建创建,注意不要写入中文,要带 https://),并重启服务。

1
2
3
4
5
6
7
8
9
10
11
12
13
14
# 创建目录
sudo mkdir -p /etc/docker
# 写入配置文件
sudo tee /etc/docker/daemon.json <<-'EOF'
{
"registry-mirrors": [
"https://docker-0.unsee.tech",
"https://docker-cf.registry.cyou",
"https://docker.1panel.live"
]
}
EOF
# 重启docker服务
sudo systemctl daemon-reload && sudo systemctl restart docker

测试代码

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
import time
import requests

# 常见 Docker 镜像源
MIRRORS = {
"官方 Docker Hub": "https://registry-1.docker.io",
"腾讯云": "https://mirror.ccs.tencentyun.com",
"Docker 中国官方": "https://registry.docker-cn.com",
"网易": "https://hub-mirror.c.163.com",
"百度": "https://mirror.baidubce.com",
"中科大": "https://docker.mirrors.ustc.edu.cn",
"上海交大": "https://mirror.sjtu.edu.cn",
"中科院软件所": "https://mirror.iscas.ac.cn",
"阿里云": "https://registry.aliyuncs.com",
"dao": "https://docker.m.daocloud.io",
"1ms": "https://docker.1ms.run",
"xdark": "https://hub.xdark.top",
"kubesre": "https://dhub.kubesre.xyz",
"kejilion": "https://docker.kejilion.pro",
"xuanyuan": "https://docker.xuanyuan.me",
"hl": "https://docker.hlmirror.com",
"rundocker": "https://run-docker.cn",
"sunzi": "https://docker.sunzishaokao.com",
"cloudlayer": "https://image.cloudlayer.icu",
"docker0": "https://docker-0.unsee.tech",
"tbedu": "https://docker.tbedu.top",
"crdz": "https://hub.crdz.gq",
"meli": "https://docker.melikeme.cn"
}

def test_mirror(name, url, timeout=3):
"""测试单个镜像源是否可用,并返回响应时间(ms),不可用返回 None"""
test_url = f"{url}/v2/"
try:
start = time.time()
resp = requests.get(test_url, timeout=timeout)
end = time.time()
if resp.status_code in (200, 401): # 200 OK 或 401 Unauthorized 都说明源可访问
return round((end - start) * 1000, 2)
except requests.RequestException:
return None
return None

def main():
results = []
print("开始测试 Docker 镜像源可用性...\n")
for name, url in MIRRORS.items():
print(f"测试: {name} ({url}) ... ", end="")
ms = test_mirror(name, url)
if ms is not None:
print(f"可用 ✅ 响应时间: {ms} ms")
results.append((name, url, ms))
else:
print("不可用 ❌")

print("\n====== 测试结果 (按速度排序) ======")
if results:
results.sort(key=lambda x: x[2]) # 按时间升序
for i, (name, url, ms) in enumerate(results, 1):
print(f"{i}. {name:<10} {url:<40} {ms} ms")
else:
print("没有可用的镜像源。")

if __name__ == "__main__":
main()
// 代码折叠