Podman Docker 镜像源配置教程
适用于 CentOS / Ubuntu / Arch 等系统,支持通过配置专属镜像地址提升镜像拉取速度、可控性与可用性。
1适用场景
- 你使用的是 Podman 替代 Docker
- 想加快从 docker.io, ghcr.io, gcr.io, k8s.gcr.io 拉取镜像的速度
- 你有自己的专属镜像地址,如:***.xuanyuan.run
2打开配置文件
编辑 Podman 的镜像仓库配置文件:
sudo nano /etc/containers/registries.conf
有些系统是 /etc/containers/registries.conf.d/ 目录内多个文件,也可以新增一个 custom.conf 文件。
3添加配置内容
在配置文件中添加以下内容:
unqualified-search-registries = ["docker.io"] [[registry]] prefix = "docker.io" insecure = true location = "registry-1.docker.io" [[registry.mirror]] location = "***.xuanyuan.run" [[registry]] prefix = "k8s.gcr.io" insecure = true location = "k8s.gcr.io" [[registry.mirror]] location = "***-k8s.xuanyuan.run" [[registry]] prefix = "registry.k8s.io" insecure = true location = "registry.k8s.io" [[registry.mirror]] location = "***-k8s.xuanyuan.run" [[registry]] prefix = "gcr.io" insecure = true location = "gcr.io" [[registry.mirror]] location = "***-gcr.xuanyuan.run" [[registry]] prefix = "ghcr.io" insecure = true location = "ghcr.io" [[registry.mirror]] location = "***-ghcr.xuanyuan.run"
说明:请将 ***.xuanyuan.run 替换为你的专属镜像地址。
4测试是否生效
运行以下命令测试是否走专属域名:
podman pull docker.io/library/alpine
然后查看是否访问了 ***.xuanyuan.run,可以在代理服务器或网络抓包工具中确认。
5常见问题
镜像拉取仍走官方源
可能原因:
- 配置文件路径错误或语法错误
- 配置文件中没有配置对应的仓库
- 专属域名没有流量
解决方法:
- 检查配置文件路径和 TOML 语法
- 检查具体是哪个仓库链接不上,配置到配置文件中
- 前往充值页面充值流量包
轩辕镜像配置手册
探索更多轩辕镜像的使用方法,找到最适合您系统的配置方式
Docker 配置
登录仓库拉取
通过 Docker 登录认证访问私有仓库
专属域名拉取
无需登录使用专属域名
K8s Containerd
Kubernetes 集群配置 Containerd
K3s
K3s 轻量级 Kubernetes 镜像加速
Dev Containers
VS Code Dev Containers 配置
Podman
Podman 容器引擎配置
Singularity/Apptainer
HPC 科学计算容器配置
其他仓库配置
ghcr、Quay、nvcr 等镜像仓库
Harbor 镜像源配置
Harbor Proxy Repository 对接专属域名
Portainer 镜像源配置
Portainer Registries 加速拉取
Nexus 镜像源配置
Nexus3 Docker Proxy 内网缓存
系统配置
需要其他帮助?请查看我们的 常见问题Docker 镜像访问常见问题解答 或 提交工单
镜像拉取常见问题
使用与功能问题
错误码与失败问题
docker pull 提示 manifest unknown 怎么办?
manifest unknown
docker pull 提示 no matching manifest 怎么办?
no matching manifest(架构)
镜像已拉取完成,却提示 invalid tar header 或 failed to register layer 怎么办?
invalid tar header(解压)
Docker pull 时 HTTPS / TLS 证书验证失败怎么办?
TLS 证书失败
Docker pull 时 DNS 解析超时或连不上仓库怎么办?
DNS 超时
Docker 拉取出现 410 Gone 怎么办?
410 Gone 排查
出现 402 或「流量用尽」提示怎么办?
402 与流量用尽
Docker 拉取提示 UNAUTHORIZED(401)怎么办?
401 认证失败
遇到 429 Too Many Requests(请求太频繁)怎么办?
429 限流
docker login 提示 Cannot autolaunch D-Bus,还算登录成功吗?
D-Bus 凭证提示
为什么会出现「单层超过 20GB」或 413,无法加速拉取?
413 与超大单层
账号 / 计费 / 权限
用户好评
来自真实用户的反馈,见证轩辕镜像的优质服务