无法使用 podman 推送到本地、重新映射的注册表

问题描述 投票:0回答:3

使用 podman 3.0.1,我在 /etc/containers/registries.conf.d/500-insecure-registries.conf 中(我并没有真正使用 example.com;相反,那里有一个真实的域名):

[[registry]]
location = 'localhost:5000'
prefix = 'example.com'
insecure = true

我有一张已标记如下的图像:

podman tag docker.io/library/hello-world example.com/hello-world

但是当我尝试按如下方式推送图像时(打算本地主机存储库):

podman push example.com/hello-world

我收到一条错误,表明它实际上正在尝试推送到 example.com 作为位置:

Error: error copying image to the remote destination: Error trying to reuse blob sha256:9c27e219663c25e0f28493790cc0b88bc973ba3b1686355f221c38a36978ac63 at destination: error pinging docker registry example.com: invalid status code from registry 404 (Not Found)

======================================

根据我在https://www.redhat.com/sysadmin/manage-container-registries“重新映射引用”下读到的内容,推送应该发送到本地注册表......所以有人知道什么吗有错吗?

提前致谢!

podman
3个回答
0
投票

当您标记图像时,目标名称是将其推送到的注册表。如果您不想推送到“example.com”,请适当标记:

podman tag docker.io/library/hello-world <registry-server>/hello-world

0
投票

我一直在使用这个方法,效果很好。如果找不到镜像或拒绝访问,它仍然会尝试回退到主

registry.location
,但如果镜像可用,它将始终首选镜像。

[[registry]]
# The image prefix to match against the referenced image.
location = "example.com"

# The alternative sources to attempt to pull from first (will fallback to
# registry.location if the image can't be pulled from the mirrors).
[[registry.mirror]]
# The locally hosted server.
location = "localhost:5000"

您还可以通过这种方式添加多个镜子。例如,您可能希望在本地托管一个注册表以进行测试,并在远程托管一个注册表以进行备份/代理:当本地注册表正在运行时,从该注册表进行推送和拉取,但如果没有运行,则回退到代理,然后仅尝试如果其他两个无法访问,则与

example.com
进行交互。

[[registry]]
location = "example.com"
[[registry.mirror]]
location = "localhost:5000"
[[registry.mirror]]
location = "proxy.example.com"

-1
投票

检查您的图像列表

podman images

虽然推送图片时会抛出错误,但看起来它已经创建了,所以它可能已经存在了。我认为这是 podman 中的一个错误,因为我遇到了与您相同的错误,但是当我检查本地注册表中的图像时,图像会显示出来。我使用 pytorch 使用另一个图像对其进行了测试,并且我能够从本地注册表中的图像创建容器并进入容器。

© www.soinside.com 2019 - 2024. All rights reserved.