Docker 镜像加速
gh-proxy.cn
将 Docker 镜像源配置为本站后,可以通过本站代理访问 Docker Hub 公共镜像。
镜像加速配置
推荐编辑 /etc/docker/daemon.json(已存在时请合并 registry-mirrors,不要覆盖其他字段):
/etc/docker/daemon.json
{
"registry-mirrors": ["https://gh-proxy.cn"]
}
重载并重启 Docker
shell
sudo systemctl daemon-reload sudo systemctl restart docker
验证
shell
docker info | grep -A2 "Registry Mirrors" docker pull alpine:latest docker pull nginx:latest
Docker Compose 复用 Docker Engine 的镜像仓库配置,无需重复设置。
docker-compose.yml
services:
web:
image: gh-proxy.cn/library/nginx:latest
ports:
- "8080:80"
/etc/containerd/config.toml
[plugins."io.containerd.grpc.v1.cri".registry.mirrors]
[plugins."io.containerd.grpc.v1.cri".registry.mirrors."docker.io"]
endpoint = ["https://gh-proxy.cn"]
shell
sudo systemctl restart containerd sudo crictl pull alpine:latest
/etc/containers/registries.conf.d/accelerator.conf
[[registry]] prefix = "docker.io" location = "gh-proxy.cn" insecure = false
shell
podman pull nginx:latest
接口对照
- GET /v2/
- API 版本检查
- GET /v2/<name>/manifests/<ref>
- Manifest / Index
- GET /v2/<name>/blobs/<digest>
- Blob 层下载
- GET /v2/<name>/tags/list
- 标签列表
代理会向上游 registry-1.docker.io 获取 Bearer Token 后重试请求,客户端无需额外配置。
快速自检
shell
curl -s https://gh-proxy.cn/v2/ -I # HTTP/2 200 # docker-distribution-api-version: registry/2.0
免责声明
本站主要提供 Docker Hub 公共镜像访问代理与加速服务,不存储镜像内容,不绕过任何访问控制。请遵守 Docker Hub 服务条款与镜像许可协议。