ECR image tagging

1

I understand that as a security best practice, tagging should be immutable. The images I have set-up are tagged with build number, Sha, and environment variables(dev/uat). Given this, the environment tag will be repeated for all the images within the same environment.

Questions:

  1. Is it possible to handle this repetitive tagging with ECR tagging to be immutable?
  2. If the tagging is changed to mutable, how does ECR identify the latest image? Does it need an explicit latest tagging? This is to be run in EKS later.

Thanks!

Dev-TVX
已提問 9 個月前檢視次數 2178 次
2 個答案
2

Hi,

Based on https://repost.aws/questions/QUN4A5R47CTcGifcCr6mWCnQ/ecr-image-tagging, you want to make your repository globally immutable by using

aws ecr create-repository --repository-name name --image-tag-mutability IMMUTABLE --region us-east-2

Then, just before you add a new image, you make the last image mutable via

aws ecr put-image-tag-mutability --repository-name name --image-tag-mutability MUTABLE --region us-east-2

Then your remove the tag 'latest' on it and switch it back to IMMUTABLE. Then, you add your latest version of the image with all tags you want + 'latest'

Best,

Didier

profile pictureAWS
專家
已回答 9 個月前
1
已接受的答案
  1. ECR tagging can be mutable/immutable. The best practice is to use immutable tagging.
  2. You need to explicitly tag it with "latest" tag.
profile picture
已回答 9 個月前
profile pictureAWS
專家
已審閱 9 個月前

您尚未登入。 登入 去張貼答案。

一個好的回答可以清楚地回答問題並提供建設性的意見回饋,同時有助於提問者的專業成長。

回答問題指南