Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to download or tag an untagged image on ECR?

The UI on ECR does not let you apply tags to images. When you push images to ECR that have a tag that exists, the existing image becomes untagged, as expected. However, there does not appear to be a way to download untagged images. For example, I can't simply download the image hash

docker pull myarn.amazonaws.com/sandbox:e226e9aaa12beb32bfe65c571cb60605b2de13338866bc832bba0e39f6819365
Error response from daemon: manifest for myarn.amazonaws.com/sandbox:e226e9aaa12beb32bfe65c571cb60605b2de13338866bc832bba0e39f6819365 not found
like image 446
wonton Avatar asked Nov 07 '18 22:11

wonton


People also ask

What is tag immutability in ECR?

Amazon ECR Tag Immutability enables customers to rely on the descriptive tags of an image as a reliable mechanism to track and uniquely identify images. Prior to this enhancement, tags could be overwritten requiring developers to use the Image SHA to know which image was being deployed.

What are untagged images?

Images that are untagged can be referenced by using the digest reference format <repository>@<digest> as opposed to the tag reference format <repository>:<tag> . Untagged images are typically the result of an image that is pushed with a pre-existing <repository>:<tag> combination.

Can an ECR image have multiple tags?

You can build an image with several tags and then push the image with the --all-tags option. Older Docker clients that do not support --all-tags will push all tags by default (simply omit the option), newer clients will only push latest by default. As an alternative, you may want to push each tag separately.


1 Answers

So I discovered a user-unfriendly way of doing this. You first tag an untagged image, then you can download it. Here I tag an untagged image to backup

MANIFEST=$(aws ecr batch-get-image --repository-name sandbox --image-ids imageDigest=sha256:e226e9aaa12beb32bfe65c571cb60605b2de13338866bc832bba0e39f6819365 --query 'images[].imageManifest' --output text)
aws ecr put-image --repository-name sandbox --image-tag backup --image-manifest "$MANIFEST"

Then I can download it as normal

docker pull myarn.amazonaws.com/sandbox:backup
like image 132
wonton Avatar answered Sep 21 '22 13:09

wonton