FuzzyIO
FuzzyIO

Reputation: 11

amazon aws ecr tag image without existing tag

I'm trying to tag an older image in aws ecr.

While Amazon offer help on retag images that HAS an existing tag. How do I tag an image with just imageDigest. Example, how do I tag the last image below with "imageDigest": "sha256:9f61b77c31..." to "dev"

aws ecr list-images --repository-name my_aws_ecr_repo
{
    "imageIds": [
        {
            "imageDigest": "sha256:c115230398..."
        },
        {
            "imageDigest": "sha256:236ce1ed44...",
            "imageTag": "latest"
        },
        {
            "imageDigest": "sha256:c1dd997eb7..."
        },
        {
            "imageDigest": "sha256:9f61b77c31..."
        }
    ]
}

Upvotes: 1

Views: 1156

Answers (1)

Boz
Boz

Reputation: 21

aws ecr batch-get-image has an option to use imageDigest instead of imageTag for image-ids: --image-ids imageDigest=

For example:

MANIFEST=$(aws ecr batch-get-image --repository-name amazonlinux --image-ids imageDigest="sha256:xxx" --query "images[].imageManifest" --output text)

Upvotes: 2

Related Questions