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.
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:
ecr batch-delete-image
commandsAnother 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/
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With