Podman 无法将图像推送到 AWS ECR 存储库,错误:写入 blob:Post

Podman 无法将图像推送到 AWS ECR 存储库,错误:写入 blob:Post

我在尝试将使用 podman 创建的图像推送到我拥有的 ECR 容器时遇到问题。

这个问题似乎与权限或身份验证无关,我在网上很难找到类似的问题。我还看到了带标签的图像,所以这个问题似乎只与推送有关。

我收到了以下 3 个错误,直到“podman push ..”命令最终失败。

[ec2-user@ip-10-0-151-137 ~]$ grep PRETTY /etc/os-release 
PRETTY_NAME="Red Hat Enterprise Linux 9.1 (Plow)"
[ec2-user@ip-10-0-151-137 ~]$ podman version 
Client:       Podman Engine
Version:      4.2.0
API Version:  4.2.0
Go Version:   go1.18.4
Built:        Wed Oct 26 18:30:14 2022
OS/Arch:      linux/amd64
[ec2-user@ip-10-0-151-137 ~]$ podman images | grep git-pod.*06
localhost/git-pod                                                  06          95d2df2c0ae0  2 days ago         310 MB
[ec2-user@ip-10-0-151-137 ~]$ 

[ec2-user@ip-10-0-151-137 ~]$ aws ecr get-login-password --region eu-central-1 | podman login --username AWS --password-stdin ACCOUNTID.dkr.ecr.eu-central-1.amazonaws.com
Login Succeeded!
[ec2-user@ip-10-0-151-137 ~]$ podman tag git-pod:06 ACCOUNTID.dkr.ecr.eu-central-1.amazonaws.com/karlito96/git-pod:06
[ec2-user@ip-10-0-151-137 ~]$ podman push ACCOUNTID.dkr.ecr.eu-central-1.amazonaws.com/karlito96/git-pod:06
Getting image source signatures
Copying blob f1f8e45a0453 [--------------------------------------] 8.0b / 18.5KiB
Copying blob 741a880671a3 [--------------------------------------] 8.0b / 31.5KiB
Copying blob ce9d08ae8f99 [--------------------------------------] 8.0b / 209.2MiB
Copying blob 6a7d463177c0 [--------------------------------------] 8.0b / 4.5KiB
Copying blob 5d8a1e83af01 [--------------------------------------] 8.0b / 5.5KiB
Copying blob 9b2fc3057618 [--------------------------------------] 8.0b / 86.2MiB
Copying blob 7aeca7e32e2f [--------------------------------------] 8.0b / 5.5KiB
Copying blob 5a56fd9df592 [--------------------------------------] 8.0b / 2.5KiB
Copying blob 82588404a590 [--------------------------------------] 8.0b / 6.0KiB
Copying blob 7b4bd06c8069 [--------------------------------------] 8.0b / 8.5KiB
WARN[0006] Failed, retrying in 1s ... (1/3). Error: writing blob: Post "https://ACCOUNTID.dkr.ecr.eu-central-1.amazonaws.com/v2/karlito96/git-pod/blobs/uploads/": EOF 
Getting image source signatures
Copying blob ce9d08ae8f99 [--------------------------------------] 8.0b / 209.2MiB
Copying blob 9b2fc3057618 [--------------------------------------] 8.0b / 86.2MiB
Copying blob 741a880671a3 [--------------------------------------] 8.0b / 31.5KiB
Copying blob 5d8a1e83af01 [--------------------------------------] 8.0b / 5.5KiB
Copying blob f1f8e45a0453 [--------------------------------------] 8.0b / 18.5KiB
Copying blob 6a7d463177c0 [--------------------------------------] 8.0b / 4.5KiB
Copying blob 7aeca7e32e2f [--------------------------------------] 8.0b / 5.5KiB
Copying blob 5a56fd9df592 [--------------------------------------] 8.0b / 2.5KiB
Copying blob 82588404a590 [--------------------------------------] 8.0b / 6.0KiB
Copying blob 7b4bd06c8069 [--------------------------------------] 8.0b / 8.5KiB
WARN[0012] Failed, retrying in 1s ... (2/3). Error: writing blob: Post "https://ACCOUNTID.dkr.ecr.eu-central-1.amazonaws.com/v2/karlito96/git-pod/blobs/uploads/": EOF 
Getting image source signatures
Copying blob 9b2fc3057618 [--------------------------------------] 8.0b / 86.2MiB
Copying blob ce9d08ae8f99 [--------------------------------------] 8.0b / 209.2MiB
Copying blob 741a880671a3 [--------------------------------------] 8.0b / 31.5KiB
Copying blob 5d8a1e83af01 [--------------------------------------] 8.0b / 5.5KiB
Copying blob f1f8e45a0453 [--------------------------------------] 8.0b / 18.5KiB
Copying blob 6a7d463177c0 [--------------------------------------] 8.0b / 4.5KiB
Copying blob 7aeca7e32e2f [--------------------------------------] 8.0b / 5.5KiB
Copying blob 5a56fd9df592 [--------------------------------------] 8.0b / 2.5KiB
Copying blob 82588404a590 [--------------------------------------] 8.0b / 6.0KiB
Copying blob 7b4bd06c8069 [--------------------------------------] 8.0b / 8.5KiB
WARN[0017] Failed, retrying in 1s ... (3/3). Error: writing blob: Post "https://ACCOUNTID.dkr.ecr.eu-central-1.amazonaws.com/v2/karlito96/git-pod/blobs/uploads/": EOF 
Getting image source signatures
Copying blob 741a880671a3 [--------------------------------------] 8.0b / 31.5KiB
Copying blob 6a7d463177c0 [--------------------------------------] 8.0b / 4.5KiB
Copying blob 9b2fc3057618 [--------------------------------------] 8.0b / 86.2MiB
Copying blob f1f8e45a0453 [--------------------------------------] 8.0b / 18.5KiB
Copying blob ce9d08ae8f99 [--------------------------------------] 8.0b / 209.2MiB
Copying blob 5d8a1e83af01 [--------------------------------------] 8.0b / 5.5KiB
Copying blob 7aeca7e32e2f [--------------------------------------] 8.0b / 5.5KiB
Copying blob 5a56fd9df592 [--------------------------------------] 8.0b / 2.5KiB
Copying blob 82588404a590 [--------------------------------------] 8.0b / 6.0KiB
Copying blob 7b4bd06c8069 [--------------------------------------] 8.0b / 8.5KiB
Error: writing blob: Post "https://ACCOUNTID.dkr.ecr.eu-central-1.amazonaws.com/v2/karlito96/git-pod/blobs/uploads/": EOF
[ec2-user@ip-10-0-151-137 ~]$ podman images | grep git-pod.*06
ACCOUNTID.dkr.ecr.eu-central-1.amazonaws.com/karlito96/git-pod  06          95d2df2c0ae0  2 days ago         310 MB
localhost/git-pod                                                  06          95d2df2c0ae0  2 days ago         310 MB
[ec2-user@ip-10-0-151-137 ~]$ 

谢谢

答案1

由于指定的存储库不存在,因此推送命令失败。

ECR 存储库名称:karlito96 Podman 镜像:标签:git-pod:06

在我的标签和推送命令中,我选择的 ECR 路径都不存在:ACCOUNTID.dkr.ecr.eu-central-1.amazonaws.com/karlito96/git-pod:06

似乎 ..amazon.com/ 之后和 : 之前的所有内容都被视为存储库名称。在上面的例子中,这将是:karlito96/git-pod,但它并不存在。

解决:

有两种方法可以解决这个问题:

  1. 使用存储库名称将本地图像标记到存储库上,使用之前使用的 ECR 存储库和图像如下所示:

     $ podman tag git-pod:06 ACCOUNTID.dkr.ecr.eu-central-1.amazonaws.com/karlito96:latest
     $ podman push ACCOUNTID.dkr.ecr.eu-central-1.amazonaws.com/karlito96:latest
    
  2. 创建一个以你的镜像名称命名的存储库,然后直接推送到该存储库:

     $ podman tag git-pod:06 ACCOUNTID.dkr.ecr.eu-central-1.amazonaws.com/git-pod:06
     $ podman push ACCOUNTID.dkr.ecr.eu-central-1.amazonaws.com/git-pod:06
    

相关内容