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

feita há um ano2710 visualizações
2 Respostas
3
Resposta aceita

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
respondido há um ano
ESPECIALISTA
avaliado há um ano
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.

ESPECIALISTA
respondido há um ano

Você não está conectado. Fazer login para postar uma resposta.

Uma boa resposta responde claramente à pergunta, dá feedback construtivo e incentiva o crescimento profissional de quem perguntou.

Diretrizes para responder a perguntas