What will happen after the maximum number of images pushed to ECR repository

浪子不回头ぞ 提交于 2019-12-07 11:19:57

问题


According to Amazon ECR Service Limits, the maximum number of images per repository is 1,000. After exceeding this limit, the oldest image won't remove automatically. It blocks pushing to the repository. So I have to clean old images manually.

Update: AWS introduced ECR Lifecycle Policies. We can now automate the cleanup with this.


回答1:


Having experienced this exact scenario, I can confirm that upon reaching the limit, AWS will block you from pushing with this very unhelpful error message:

Error pushing to registry: Server error: 403 trying to push <repo>:<label> manifest

You'll need to manage the number of repositories yourself. As there is currently no built in garbage collection (nor 'remove oldest') functionality, you have a few options:

  1. Remove the images via the console (which really is just woeful with so many images)
  2. Write your own tool that interfaces with the AWS CLI/SDK using the ecr batch-delete-image commands
  3. Request a limit to the maximum number you can store per repository. We've recently done this and was very easy to get the 1,000 limit increased to 5,000.



回答2:


Another solution is to define ECR lifecycle policies. Here is a how-to guide: https://aws.amazon.com/blogs/compute/clean-up-your-container-images-with-amazon-ecr-lifecycle-policies/



来源:https://stackoverflow.com/questions/41755658/what-will-happen-after-the-maximum-number-of-images-pushed-to-ecr-repository

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!