添加 Docker 国内镜像源
1. 修改 /etc/docker/daemon.json
设置 registry-mirrors,具体命令如下:
sudo cat > /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
该配置文件名可能因机器而异,请在路径下确认实际文件名。
设置 registry-mirror,具体命令如下:
# 进入 Podman 虚拟机
podman machine ssh
# 修改 Podman 注册表配置
sudo vi /etc/containers/registries.conf.d/999-podman-machine.conf
# ---------- 配置内容如下 -----------------
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"
当前环境为 Windows 11 下的 Podman,需要执行 Podman Machine 步骤。纯 Linux 环境可跳过此步。
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:74cc54e27dc4b2226072d44602 Writing manifest to image destination 74cc54e27dc4b2226072d44602


