1、环境准备
准备一台能访问docker.io的机器,我这里使用windows服务器
安装docker windows环境
https://learn.microsoft.com/zh-cn/virtualization/windowscontainers/quick-start/set-up-environment?tabs=dockerce
https://docs.docker.com/desktop/install/windows-install/
2、安装完成后启动图形界面
3、运行registry 容器
cmd 运行里执行
bash
docker run -d -p 5000:5000 --name registry -e REGISTRY_PROXY_REMOTEURL=https://registry-1.docker.io registry:2
4、设置docker 使用registry pull镜像(ip为你跑registry的皮的地址)
bash
vi /etc/docker/daemon.json
bash
{
"insecure-registries": ["ip:5000"],
"registry-mirrors": ["http://ip:5000"]
}
重启docker
bash
sudo systemctl daemon-reload
sudo systemctl restart docker
5、设置podman 使用registry pull镜像(ip为你跑registry的皮的地址)
bash
vi /etc/containers/registries.conf
bash
unqualified-search-registries = ["docker.io"]
[[registry]]
prefix = "docker.io"
location = "ip:5000"
insecure = true
重启podman
bash
sudo systemctl daemon-reload
sudo systemctl restart podman
全部完成后就可以直接拉取镜像了