换源/Docker 多仓库镜像
Docker 多仓库镜像 镜像源
ghcr.io / gcr.io / quay.io / registry.k8s.io / mcr.microsoft.com 等非 Docker Hub 仓库的国内镜像(DaoCloud 多仓库),docker pull 提速。
可用镜像源(7)
| 源 | 地址 | 说明 |
|---|---|---|
| DaoCloud · Docker Hub | https://docker.m.daocloud.io | 多仓库全覆盖,推荐 |
| DaoCloud · ghcr | https://ghcr.m.daocloud.io | — |
| DaoCloud · gcr | https://gcr.m.daocloud.io | — |
| DaoCloud · k8s | https://k8s.m.daocloud.io | registry.k8s.io / k8s.gcr.io |
| DaoCloud · quay | https://quay.m.daocloud.io | — |
| DaoCloud · mcr | https://mcr.m.daocloud.io | mcr.microsoft.com |
| 1MS · Docker Hub | https://docker.1ms.run | 仅 Docker Hub |
换源方法
直接拉取(替换 registry 前缀)
把原 registry host 换成镜像 host,路径与 tag 不变;首页工具粘贴镜像引用可自动生成
docker pull ghcr.m.daocloud.io/<owner>/<image>:<tag>
docker pull k8s.m.daocloud.io/pause:3.9
docker pull quay.m.daocloud.io/prometheus/node-exporter:v1.7.0拉取后重新打 tag(供 compose / k8s 使用)
docker pull ghcr.m.daocloud.io/owner/app:1.0
docker tag ghcr.m.daocloud.io/owner/app:1.0 ghcr.io/owner/app:1.0containerd / k8s 节点配置 mirror
containerd 在 /etc/containerd/certs.d/<registry>/hosts.toml 配置 mirror;kubelet 拉取 pause 等系统镜像同理
# /etc/containerd/certs.d/registry.k8s.io/hosts.toml
server = "https://registry.k8s.io"
[host."https://k8s.m.daocloud.io"]
capabilities = ["pull", "resolve"]注意
公共加速器时效性强、可能限流;私有镜像需鉴权,不要经第三方镜像传 token;稳定生产建议自建 registry 缓存(registry:2 proxy 模式)
# 自建缓存:docker run -d -p 5000:5000 -e REGISTRY_PROXY_REMOTEURL=https://registry-1.docker.io registry:2使用提示
- ·公共 registry 加速器时效性强(2024 后大量关停),失效就换节点或自建缓存。
- ·私有镜像需鉴权,token 不要经第三方镜像中转。
- ·生产环境尽量用 digest 或锁定 tag,避免 tag 漂移。
- ·大文件/多层镜像可配 registry:2 proxy 自建缓存,一次拉取长期复用。