现在国内下载docker镜像基本上是下不了了,即使是配置了国内的第三方镜像加速服务也是不行的。
比如我这里配了主流的三个

但一样是下载失败
如何自己推荐加速服务呢?
自已建:https://github.com/bboysoulcn/registry-mirror
使用cloudflare代理:https://github.com/ImSingee/hammal
1.1 使用cloudflare
🚅
注意:因为wrangler无法在国内使用,所以才用这种方法
1.1.1 下载代码
首先下载仓库 代码到本地,同时也要clone到自己的github账号下面。
https://github.com/ImSingee/hammal
1.1.2 安装库
yaml
npm install
1.1.3 创建 Workers 项目
进入 Cloudflare Dashboard 创建一个新的 Workers 项目,给他一个命名(例如 hammal
)

取完名字后,直接点部署
需要配置自定义域


1.1.4 配置项目
复制 wrangler.toml.sample
文件改名 wrangler.toml
并修改其 name
和 account_id

account_id 可以从 CF Workers Dashboard 右侧获得

1.1.5 创建 cache 缓存 kv

把kv id记录下来,填到配置里

1.1.6 关联上github项目

提交github后就会触发部署
1.1.7 Deploy
进入你的 Workers 脚本的 dashboard,为它绑定一个自定义域名(必要,因为默认的 workers.dev
域名被墙了)

1.1.8 本地配置
使用你的自定义域名作为 docker registry mirror 即可
修改/etc/docker/daemon.json
windows上是%userprofile%\.docker\daemon.json
.
yaml
{
"registry-mirrors": [
"https://hammal.example.com" //你的域名
]
}
启用
yaml
sudo systemctl daemon-reload
sudo systemctl restart docker