public-image-mirror README

The project's README from github.com/DaoCloud/public-image-mirror. As one markdown file: README.md.

public-image-mirror

源仓库 Github
Mirror 仓库 Gitee

背景 & 目标

很多镜像都在国外。比如 gcr 。国内下载很慢,需要加速。

快速开始

docker run -d -P m.daocloud.io/docker.io/library/nginx

使用方法

增加前缀 (推荐方式)。比如:

              docker.io/library/busybox
                 |
                 V
m.daocloud.io/docker.io/library/busybox

或者 支持的镜像仓库 的 前缀替换 就可以使用。比如:

           docker.io/library/busybox
             |
             V
docker.m.daocloud.io/library/busybox

支持前缀替换的 Registry (不推荐)

推荐使用添加前缀的方式.

前缀替换的 Registry 的规则, 这是人工配置的, 有需求提 Issue.

这里每一个源站内容都是不同的, 不要把 docker.io 之外的站点配置给 docker 的 registry-mirrors

源站 替换为 备注
docker.elastic.co elastic.m.daocloud.io
docker.io docker.m.daocloud.io
dhi.io dhi.m.daocloud.io
gcr.io gcr.m.daocloud.io
ghcr.io ghcr.m.daocloud.io
k8s.gcr.io k8s-gcr.m.daocloud.io k8s.gcr.io 已被迁移到 registry.k8s.io
registry.k8s.io k8s.m.daocloud.io
mcr.microsoft.com mcr.m.daocloud.io
nvcr.io nvcr.m.daocloud.io
quay.io quay.m.daocloud.io
registry.ollama.ai ollama.m.daocloud.io 实验内测中,使用方法

最佳实践

部署内网缓存

本地缓存部署用于在内网环境中加速镜像拉取,减少对外网的依赖。通过设置一个本地镜像仓库,您可以缓存常用的镜像。 请参考文档

加速 Kubneretes

加速安装 kubeadm

apiVersion: kubeadm.k8s.io/v1beta3
kind: ClusterConfiguration
dns:
  imageRepository: k8s.m.daocloud.io/coredns
imageRepository: k8s.m.daocloud.io
...

加速安装 kind

kind create cluster --name kind --image m.daocloud.io/docker.io/kindest/node:v1.22.1

加速所有 Pod

https://github.com/wzshiming/repimage

不修改 yaml, helm 等, 仅使用 Webhook, 自动修改所有新建 Pod 的 image 使用本 mirror

kubectl create -f https://files.m.daocloud.io/github.com/wzshiming/repimage/releases/download/latest/repimage.yaml
kubectl rollout status deployment/repimage -n kube-system

加速 Containerd

加速 Docker

添加到 /etc/docker/daemon.json

{
  "registry-mirrors": [
    "https://docker.m.daocloud.io"
  ]
}

加速 Podman

添加到 /etc/containers/registries.conf (rootless 模式也可以添加到 ~/.config/containers/registries.conf)

[[registry]]
location = "docker.io"

[[registry.mirror]]
location = "docker.m.daocloud.io"

与 Docker 不同, Podman 还支持为 docker.io 之外的 registry 配置 mirror, 例如:

[[registry]]
location = "gcr.io"

[[registry.mirror]]
location = "gcr.m.daocloud.io"

[[registry]]
location = "ghcr.io"

[[registry.mirror]]
location = "ghcr.m.daocloud.io"

[[registry]]
location = "quay.io"

[[registry.mirror]]
location = "quay.m.daocloud.io"

[[registry]]
location = "registry.k8s.io"

[[registry.mirror]]
location = "k8s.m.daocloud.io"

加速 Ollama & DeepSeek

加速安装 Ollama

CPU:

docker run -d -v ollama:/root/.ollama -p 11434:11434 --name ollama docker.m.daocloud.io/ollama/ollama

GPU 版本:

  1. 首先安装 Nvidia Container Toolkit
  2. 运行以下命令启动 Ollama 容器:
docker run -d --gpus=all -v ollama:/root/.ollama -p 11434:11434 --name ollama docker.m.daocloud.io/ollama/ollama

更多信息请参考:

加速使用 Deepseek-R1 模型(实验内测中)

如上述步骤,在启动了ollama容器的前提下,还可以通过加速源,加速启动DeepSeek相关的模型服务

注:目前 Ollama 官方源的下载速度已经很快,您也可以直接使用官方源。

# 使用加速源
docker exec -it ollama ollama run ollama.m.daocloud.io/library/deepseek-r1:1.5b

# 或直接使用官方源下载模型
# docker exec -it ollama ollama run deepseek-r1:1.5b

[友情链接]加速二剑客

贡献者

Made with contrib.rocks.

public-image-mirror (DaoCloud/public-image-mirror)

Searching Database…

What is this?It is a public mirror service for container registries (like gcr.io, ghcr.io, docker.io, quay.io) run by DaoCloud, meant to speed up pulling images for users in China where those registries are slow.
Is this a tool I install, or a hosted service?It's a hosted mirror service (m.daocloud.io), not something you install; this repo mainly holds docs, config lists, and CI scripts that manage the mirror.
How do I actually use it?The recommended way is to prepend the mirror prefix to an image name, e.g. pulling from gcr.m.daocloud.io instead of gcr.io; for Docker/Podman/Kubernetes you can also configure registry mirrors in daemon.json or registries.conf.
Do I need any special client or account to use the mirror?No, you just use your normal Docker, Podman, containerd, or kubeadm/kind tooling and point it at the mirror host or prefix — no account or extra software required.
Does the cache always have the image I want?Cached content is only kept for 30 days and gets re-synced lazily, so a blob can disappear and return a 404 if it expires between the 1-minute blob cache and resync; it's best to pull during off-peak hours (1-7am Beijing time).
Who is this mirror meant for?Primarily developers and ops teams in mainland China who need faster, reliable access to foreign container registries.
Which registries does it mirror?It mirrors major registries including docker.io, gcr.io, ghcr.io, k8s.gcr.io/registry.k8s.io, mcr.microsoft.com, nvcr.io, quay.io, and experimentally registry.ollama.ai.
Is the hash/content guaranteed to match the original image?Yes — it states it only mirrors the source registry and keeps all sha256 hashes identical to the original via a lazy-loading mechanism.
Can I accelerate Ollama and DeepSeek models through this?Yes, there's a dedicated section for speeding up Ollama container pulls (CPU and GPU/Nvidia Container Toolkit setups) and experimentally accelerating DeepSeek-R1 model downloads via Ollama.
Can I run my own local cache instead of using the public mirror?Yes, the README documents a best practice for deploying an intranet image cache to reduce reliance on external network access.
Can it automatically rewrite all my Kubernetes pod images without editing YAML?Yes, it mentions a webhook-based approach that automatically rewrites new pod image references to use the mirror without touching manifests or Helm charts.
Creator
DaoCloud
Size
1.5 MB
Stars
15.2K
Updated
CommitOct 16
Age
5y
Commits · 90 Days