Tags of ECR images concatenate, if images are the same.

0

So, i found out, if i push the same image, but with the different tag names, to the same repository in the AWS ECR, tags concatenate. I dont think thats how it should work? is it a bug, or im not understanding something?

Thanks

질문됨 일 년 전2939회 조회
2개 답변
3
수락된 답변

This is actually the expected behavior in AWS ECR. When you push an image to a repository with a different tag name, the image will be stored as a new tag for the same image, rather than creating a new copy of the image. This means that the tags will essentially be pointing to the same image, and any changes made to one tag will be reflected in all the other tags as well.

This behavior can be useful in cases where you have multiple versions of the same image and you want to keep them organized under the same repository. However, if you want to create completely separate copies of the image with different tags, you'll need to use different repository names or use a separate registry altogether.

AWS_Guy
답변함 일 년 전
전문가
검토됨 일 년 전
1

Expanding on the answer by @AWS_Guy, it's up to you whether you have images for one package (multiple versions of it) per repository or have images for lots of packages (and their versions) in a repository. You just manage it appropriately with a tagging strategy, e.g tagging each image ServiceName_VersionNumber.

When you upload an image by default it's tagged "latest" (and the previous "latest" becomes untagged) but you can instead decide what tag(s) to apply - typically include a version number. Note that making use of the default "latest" behaviour therefore only makes sense with images for a single package (with multiple versions) in a repo.

It's common to want to do both:

  • tag your images with a version number, and
  • be able to always refer to "latest" rather than a specific version number from ECS etc.

A common solution is to push the built image twice - first with no tag (ends up tagged "latest") and then with the version tag. ECR is smart enough to recognise that the image digest did not change and it will not try to actually upload the image twice. On the second push only the tag will be send to ECR. This is the behaviour you've seen.

전문가
답변함 일 년 전

로그인하지 않았습니다. 로그인해야 답변을 게시할 수 있습니다.

좋은 답변은 질문에 명확하게 답하고 건설적인 피드백을 제공하며 질문자의 전문적인 성장을 장려합니다.

질문 답변하기에 대한 가이드라인

관련 콘텐츠