问题
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:
- Remove the images via the console (which really is just woeful with so many images)
- Write your own tool that interfaces with the AWS CLI/SDK using the
ecr batch-delete-image
commands - 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