简体   繁体   English

将图像推送到 ECR 仅适用于私有存储库

[英]Push image to ECR works for private repositories only

I'm trying to push an image to a public repository in ECR.我正在尝试将图像推送到 ECR 中的公共存储库。 To be able to do so, I created a policy that gives push permissions and attached this policy to my user.为了能够这样做,我创建了一个提供推送权限的策略并将该策略附加到我的用户。 The policy in JSON format is the following: JSON格式的策略如下:

{
    "Version": "2012-10-17",
    "Statement": [
        {
            "Effect": "Allow",
            "Action": [
                "ecr:*"
            ],
            "Resource": "arn:aws:ecr:us-east-1:*:repository/my-app"
        },
        {
            "Effect": "Allow",
            "Action": [
                "ecr:*"
            ],
            "Resource": "arn:aws:ecr:us-east-1:*:repository/my-app-public"
        },
        {
            "Effect": "Allow",
            "Action": [
                "ecr:GetAuthorizationToken"
            ],
            "Resource": "*"
        }
    ]
}

The push works fine for the private repository but gives the error denied: Not Authorized when I try to push the image to the public repo.推送对于私有存储库工作正常,但在我尝试将图像推送到公共存储库时出现错误denied: Not Authorized How can I push an image to an ECR public repo?如何将图像推送到 ECR 公共存储库?

ECR Public is its own service (with its own ecr-public:* actions). ECR Public 是它自己的服务(有它自己的ecr-public:*动作)。 To push images to ECR Public, a set of ecr-public actions is needed in the statement.要将图像推送到 ECR Public,声明中需要一组 ecr-public 操作。

The first example here should get you on the right track: https://docs.aws.amazon.com/AmazonECR/latest/public/public-repository-policy-examples.html这里的第一个例子应该让你走上正轨: https://docs.aws.amazon.com/AmazonECR/latest/public/public-repository-policy-examples.html

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 即使登录 docker 并成功,也无法将图像推送到 ECR - can't push image to ECR even though login in docker and was successfully 找不到图像:404 客户端错误:找不到:aws-ecr-push-image atlassian 管道 - Image not found: 404 Client Error: Not Found: aws-ecr-push-image atlassian pipeline 使用 terraform 构建 docker 映像,将其推送到 ECR 存储库,获取配置程序“local-exec”错误 - Build docker image with terraform push it to ECR repo getting provisioner "local-exec" error 如何使用 buildspec.yml 在 AWS CodePipeline 中从 Dockerfile 构建图像,然后推送到 ECR? - How to build Image from Dockerfile in AWS CodePipeline using buildspec.yml, and then push to ECR? 如何从 AWS ECR 中提取私有 docker 图像以与 Java 中的 Testcontainers 库一起使用 - How to pull a private docker image from AWS ECR to use with the Testcontainers library in Java 无法将 Dockerimages 推送到 ECR - Can't push Dockerimages to ECR FCM - 推送通知仅适用于控制台而不适用于邮递员 - FCM - Push notification works only in console not in postman ECR - 具有多个站点的 Ngnix 图像 - ECR - Ngnix image with multiple sites 如何在 Githubactions 中从 ECR 中提取 docker 图像 - How to pull docker image from ECR in Githubactions buildx build --platform amd64,arm64 --push 在 ECR 中创建 3 个资源 - 2 个图像和 1 个图像索引,我如何标记它们? - buildx build --platform amd64,arm64 --push creates 3 resources in ECR - 2 images and 1 image index, how do I tag them?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM