podman/docker国内可用的docker镜像源(2025-05)

一、添加Docker国内镜像

1、修改 /etc/docker/daemon.json

设置 registry mirror,具体命令如下:

sudo vim /etc/docker/daemon.json <<EOF
{
    "registry-mirrors": [
        "https://docker.1ms.run",
        "https://docker.xuanyuan.me",
        "https://hub.rat.dev",
        "https://docker.1panel.live"
    ]
}
EOF

2、重启docker:

systemctl daemon-reload
systemctl restart docker

二、添加Podman国内镜像

1、修改 /etc/containers/registries.conf.d/999-podman-machine.conf

999-podman-machine.conf 这个文件名字可能每台机子有自己的名称,可以在路径下找到自己的名字。

设置 registry mirror,具体命令如下:

# enter into the podman virtual machine
podman machine ssh

# change the podman registries
sudo vi /etc/containers/registries.conf.d/999-podman-machine.conf

# ----------contents as follows -----------------
   unqualified-search-registries = ["docker.io"]

   [[registry]]
   prefix = "docker.io"
   location = "docker.1ms.run"

   [[registry]]
   prefix = "docker.io"
   location = "hub.rat.dev"

   [[registry]]
   prefix = "docker.io"
   location = "docker.xuanyuan.me"

   [[registry]]
   prefix = "docker.io"
   location = "docker.1panel.live"                                                                                     


 我的环境时windows11下的podman,所以需要podman machine,纯linux环境可以跳过podman machine这步。

2. 重新podman machine

podman machine stop

podman machine start

3. 测试是否成功

podman pull docker.1ms.run/library/hello-world

 Trying to pull docker.1ms.run/library/hello-world:latest...
Getting image source signatures
Copying blob sha256:e6590344b1a5dc518829d6ea1524fc12f8bcd14ee9a02aa6ad8360cce3a9a9e9
Copying config sha256:74cc54e27dc41bb10dc4b2226072d469509f2f22f1a3ce74f4a59661a1d44602
Writing manifest to image destination
74cc54e27dc41bb10dc4b2226072d469509f2f22f1a3ce74f4a59661a1d44602

输出所示,表示registry配置成功。

三、docker/podman search 镜像名 报错时

通过docker/podman search 镜像名 不能查找的时候,通常报错:Get "https://index.docker.io/v2/" ...timeout.

 podman search hello-world
Error: 2 errors occurred:
        * couldn't search registry "docker.io": pinging container registry index.docker.io: Get "https://index.docker.io/v2/": dial tcp 202.160.130.52:443: i/o timeout
        * couldn't search registry "xuanyuan.me": pinging container registry xuanyuan.me: StatusCode: 404, "<html>\r\n<head><title>404 Not Found</title></head>\r..."

可以尝试来网站上手动查找自己需要的镜像,然后使用pull命令+镜像限定名称获得。

https://docker.1ms.run

首页 - 毫秒镜像

https://docker.xuanyuan.me

DockerHub镜像加速器 - 免费Docker镜像源国内加速 - DockerHub加速国内解决方案

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值