为什么 Podman 在从文件加载后试图拉取已经存在的图像?

Why is Podman trying to pull an image that already exists after loading from file?

我在气隙环境中工作 运行使用 Podman 打包的 Fedora CoreOS。我有几个容器图像,我一直致力于将其传输到气隙环境中。为此,我遵循了以下步骤:

  1. 我是在一台可以上网的机器上获取图像的。有些图像是使用 podman pull docker-daemon:docker.io/my-example-image:latest 从我的 Docker 注册表中提取到 Podman 中的,而有些图像是使用 podman pull.
  2. 直接从在线存储库中提取的
  3. 我使用(例如)podman save docker.io/my-example-image:latest -o my-example-image.tar
  4. 将图像保存到 tar 文件
  5. 我将 tar 文件传输到物理介质上的气隙环境并使用 podman load -i my-example-image.tar
  6. 加载它们

当我使用 podman images 检查图像时,它们都出现在图像列表中。但是,如果我尝试使用 sudo podman run docker.io/my-example-image 从其中一个图像 运行 一个容器,我会收到一条很长的错误消息:

Trying to pull docker.io/my-example-image
Get "https://registry-1.docker.io/v2/": dial tcp: lookup registry-1.docker.io on [::1}:53: read udp [::1]:50762 ->
  [::1]:53: read: connection refused
Error: unable to pull docker.io/my-example-image: Error initializing source docker://my-example-image:latest:
  error pinging docker registry registry-1.docker.io: Get "https://registry-1.docker.io/v2/": dial tcp: lookup
  registry-1.docker.io on [::1]:53: read udp [::1]50762 -> [::1]:53: read: connection refused

对于从 quay.io

等其他存储库获取的图像,我收到了类似的消息

在我看来,该错误是由于机器无法与注册表建立连接引起的,考虑到环境是气隙的,这对我来说很有意义。但我不确定为什么 podman 甚至在 podman images

确认的环境中已经存在这些图像时还要尝试提取这些图像

我已经尝试使用各种方式在 podman run 命令中引用图像,包括

sudo podman run docker.io/my-example-image:latest sudo podman run my-example-image sudo podman run my-example-image:latest

我已尝试寻找此问题的解决方案,但无济于事,非常感谢对此的任何指导。

每个用户都有自己的容器存储。

用户root使用目录/var/lib/containers/

普通用户使用目录~/.local/share/containers/

命令 podman load -i my-example-image.tar 将使用目录 ~/.local/share/containers/

命令 sudo podman run docker.io/my-example-image 将使用目录 /var/lib/containers

如果您想在用户之间共享只读容器存储, 查看文件 storage.conf

中的设置 additionalimagestores
[storage.options]
additionalimagestores = [ "/var/lib/mycontainers",]

参考: https://www.redhat.com/sysadmin/image-stores-podman