Cloudflare+Workers+域名 打造dockerhub自用私有镜像仓库(ubuntu、openwrt)
github项目地址:
https://github.com/cmliu/CF-Workers-docker.io
参考网址:
---------------------------------------------------------------------------------------------------------------------
具体做法:
先去创建workers
粘贴相关配置后进行部署,然后设置里添加自定义域名即可。
然后返回ubuntu服务器,如果不存在则建此文件:
nano /etc/docker/daemon.json
配置此文件内容如下,地址改为自定义域名:
{
"registry-mirrors":
[
"https://xxx.com"
]
}systemctl daemon-reload
systemctl restart docker
---------------------------------------------------------------------------------------------------------------------
2025.01.28.更新openwrt的方法(原来的容器会都消失哦):
nano /etc/docker/daemon.json
{
"data-root": "/opt/docker",
"log-level": "warn",
"registry-mirrors": ["https://dockermirror.xxx"]
}原来的容器会都消失哦:
/etc/init.d/dockerd restart #重启docker服务
/etc/init.d/dockerd stop #停止docker服务
/etc/init.d/dockerd start #开启docker服务
---------------------------------------------------------------------------------------------------------------------
2025.02.03.遇到docker network地址池满了以后怎么办:
当创建容器时候会同时创建网络,当出现以下提示时,说明默认的地址池满了,需要增加:
Error response from daemon: all predefined address pools have been fully subnetted
具体做法,结合以上的dockerhub的代理后这么做:
{
"default-address-pools": [{"base": "10.10.0.0/16", "size": 24}],
"registry-mirrors": ["https://dockermirror.xxx"]
}---------------------------------------------------------------------------------------------------------------------
测试是否可以下载镜像:
docker pull debian
docker image ls docker rmi xxxxxx #删除下载测试用的镜像
注:如果docker版本过旧,需要先升级docker的。
---------------------------------------------------------------------------------------------------------------------
另外有一个项目也能简单解决这个问题,项目地址:
https://github.com/bboysoulcn/registry-mirror
可以到服务器上先:git clone https://github.com/bboysoulcn/registry-mirror
然后进到./docker/dockerhub里边去docker compose up -d 一下。或者需要其他代理的话,进到其他文件夹看看,一样是可以的。
---------------------------------------------------------------------------------------------------------------------
2026.02.19:
ubuntu server在这个位置:
/etc/docker/daemon.json
内容:
{
"default-address-pools": [{"base": "10.10.0.0/16", "size": 24}],
"registry-mirrors": [
"https://mirror.ccs.tencentyun.com",
"https://dockermirror.zerofun.uk",
"https://docker.1ms.run",
"https://docker.1panel.live",
"https://docker.m.ixdev.cn",
"https://hub.rat.dev",
"https://docker.xuanyuan.me"
]
}istoreos用的uci,在这个位置:
/etc/config/dockerd
内容:
config globals 'globals' option data_root '/ext_overlay/upper/opt/docker' #按实际 option log_level 'warn' option iptables '0' option remote_endpoint '0' list registry_mirrors 'https://mirror.ccs.tencentyun.com' list registry_mirrors 'https://dockermirror.zerofun.uk' list registry_mirrors 'https://docker.1ms.run' list registry_mirrors 'https://docker.1panel.live' list registry_mirrors 'https://docker.m.ixdev.cn' list registry_mirrors 'https://hub.rat.dev' list registry_mirrors 'https://docker.xuanyuan.me' config proxies 'proxies' config firewall 'firewall' option device 'docker0' list blocked_interfaces 'wan'