Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

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.

like image 399
sith Avatar asked Jan 20 '17 03:01

sith


2 Answers

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.
like image 133
Luke Peterson Avatar answered Nov 07 '22 14:11

Luke Peterson


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/

like image 4
John Russell Avatar answered Nov 07 '22 15:11

John Russell