【问题标题】:Podman build command unable to pull imagePodman build 命令无法拉取镜像
【发布时间】:2021-05-21 07:41:56
【问题描述】:

我在RHEL7中安装Podman后配置了Subuid和Subgid

我创建了一个简单的 Dockerfile 来打印 hello world 并尝试构建图像。 我的 Dockerfile

FROM alpine
CMD ["echo", "Hello World"]

为了测试我在命令下运行

Podman build -t imagename .

我看到收到以下错误。

STEP 1: FROM alpine
Error: error creating build container: The following failures happened while trying to pull image specified by "alpine" based on search registries in /etc/containers/registries.conf:
* "localhost/alpine": Error initializing source docker://localhost/alpine:latest: error pinging docker registry localhost: Get https://localhost/v2/: dial tcp [::1]:443: connect: connection refused
* "registry.access.redhat.com/alpine": Error initializing source docker://registry.access.redhat.com/alpine:latest: error pinging docker registry registry.access.redhat.com: Get https://registry.access.redhat.com/v2/: read tcp 10.70.85.174:17758->23.54.147.129:443: read: connection reset by peer
* "registry.redhat.io/alpine": Error initializing source docker://registry.redhat.io/alpine:latest: error pinging docker registry registry.redhat.io: Get https://registry.redhat.io/v2/: read tcp 10.70.85.174:36028->104.79.150.216:443: read: connection reset by peer
* "docker.io/library/alpine": Error initializing source docker://alpine:latest: error pinging docker registry registry-1.docker.io: Get https://registry-1.docker.io/v2/: read tcp 10.70.85.174:53352->18.213.137.78:443: read: connection reset by peer

我是否缺少任何配置?

谢谢

【问题讨论】:

    标签: rhel7 podman


    【解决方案1】:

    您是否仍在运行 docket Daemon 和/或安装 docker?

    首先停止 docker 守护进程

     sudo systemctl stop docker 
    

     sudo service docker stop
    

    然后卸载docker 这里是 Ubuntu,但你需要什么都可以谷歌 :D

    sudo apt-get remove docker docker-engine docker.io containerd runc
    

    再试一次,

    如果其他失败,请尝试重新安装 podman

    sudo --reinstall install podman
    

    来源

    https://www.cyberciti.biz/faq/debian-ubuntu-linux-reinstall-a-package-using-apt-get-command/
    https://askubuntu.com/questions/935569/how-to-completely-uninstall-docker
    https://intellipaat.com/community/43965/how-to-stop-docker
    https://podman.io/getting-started/installation
    

    【讨论】:

    • 感谢您的评论,但有什么需要停止 docker 并卸载它?我们不能在 Docker 运行时也有 Podman 吗?
    • 完全可以同时使用 docker 和 postman。有点没必要,因为 podman 有更多功能并且更安全。这些图像,虽然 docker 和 podman 可以使用相同的图像,但它们确实将它们存储在不同的位置,并且可能会有点混乱。让 docker 守护进程运行我们是罪魁祸首。
    • 好的,鲍勃,我会尝试你的建议并告诉你
    • 我已经卸载了 Docker 并重新安装了 Podman,现在我面临一个新的错误 podman build -t podmanimg1 。第 1 步:从 registry.access.redhat.com/rhel7/rhel 获取镜像源签名 .... 存储签名错误:创建构建容器时出错:提交完成的镜像时出错:使用 blob“sha256:b8e505a039d6d08bfb73”添加层时出错:错误处理 tar 文件(退出状态 1):命名空间中可能没有足够的可用 ID(为 /run/systemd/netif 请求 192:192):lchown /run/systemd/netif:无效参数
    【解决方案2】:

    我建议您首先在注册表中搜索您的图像

    podman search alpine
    

    您应该获得可用图像列表。选择您想要的 - 版本、名称、标签等并将其放入 dockerfile。

    为确保可访问,请手动“拉动”

    podman pull alpine<version,tag>
    

    【讨论】:

    • 我尝试了你所说的,它给了我更多错误 ERRO[0001] 错误搜索注册表“registry.access.redhat.com”:无法搜索注册表“registry.access.redhat.com ": ping docker registry registry.access.redhat.com 时出错:Get registry.access.redhat.com/v2: read tcp 10.xxx:32528->xxx:443: read: connection reset by peer, error search registry "docker.io": could' t search registry "docker.io": error pinging docker registry index.docker.io: Get index.docker.io/v2: read tcp xxx:51053->3x.xx:443: read: error pinging docker registry
    • 我应该通过更新注册表配置来配置任何本地主机注册表吗?
    • 好的,那么您在连接注册表时确实遇到了问题。在某些系统上,注册表配置位于 '/etc/containers/registries.conf' 中。你在什么系统上?红帽的虚拟机?如果您不是在管理系统,我建议您联系管理员并解决问题。
    猜你喜欢
    • 1970-01-01
    • 2015-04-12
    • 1970-01-01
    • 2016-08-20
    • 2023-04-03
    • 2019-09-30
    • 2018-11-16
    • 1970-01-01
    • 2022-08-09
    相关资源
    最近更新 更多