Skip to main content
Version: 1.0.0

ECR Container Image Cleanup

Zeet automates Amazon Elastic Container Registry (ECR) image management for service container or job container project types on AWS. This feature is designed for Zeet-managed Kubernetes clusters, focusing on simplifying container registry management and optimizing storage.

Cleanup Features

The cleanup process includes:

  • Build Cache Expiration: Expires build cache images older than 30 days, running hourly to keep only recent caches. This helps ensure that the build process executes faster by reusing existing build caches while also removing outdated and unnecessary build cache images.
  • Deployment Image Expiration: Retains the last 10 images for each project or branch, targeting images older than 7 days for potential deletion. This ensures the last 10 images are always available, providing a safety net for live deployments and allowing for instant rollback if needed. The process executes hourly, aligning storage needs with project requirements.

These cleanup processes runs automatically for all Zeet-managed EKS clusters and do not require any configuration or set up.

Custom AWS ECR Lifecycle Policies

For users needing specific image retention rules, AWS ECR lifecycle policies offer a solution. These policies might include conditions like deleting images older than 30 days. However, AWS policies may not differentiate between active and inactive images, posing a risk of removing images still in use.

To set up a custom lifecycle policy:

  1. Access the Amazon ECR console in your AWS account.
  2. Choose your repository.
  3. Navigate to "Lifecycle Policies."
  4. Click "Create lifecycle policy," setting rules based on your preferences, such as image age.
  5. Save your policy, and AWS will apply it to your repository.

We recommend deploying more frequently to ensure your images remain active, especially when using custom AWS policies. Frequent deployments help keep your images within the safe criteria of these policies, avoiding unintended deletions.