Skip to content

πŸ› A golang implementation for removing old images from ECR repositories

License

Notifications You must be signed in to change notification settings

mattevans/ecr-cleanse

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

13 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

ecr-cleanse

Go Report Card license

The documented limit to the number of images in an ECR repository is 1000 (Now 10K as of Jul 19 2019). This is a golang implementation for removing unused images from your ECR repositories.

This script will inspect all container services/tasks, across all ECS clusters, removing images that are not in-use (in batches of 100).

Usage

go run main.go

Flags

  • -aws-region: Pass your AWS region.
  • -dry-run: Execute the script without purging any images.
go run main.go -aws-region us-west-2 -dry-run

Example Output

INFO[0005] Dry Run: true
INFO[0005] AWS Region: us-west-2
INFO[0005] Repositories Found: 3
INFO[0005] Active Images Found: 8
INFO[0005] ----------------------------------------------------------------
INFO[0005] Repository: my.production.repository
INFO[0005] [DRY RUN] `2` images would be purged
INFO[0005] ----------------------------------------------------------------
INFO[0005] Repository: my.staging.repository
INFO[0005] [DRY RUN] `2` images would be purged
INFO[0005] ----------------------------------------------------------------
INFO[0006] Repository: my.test.repository
INFO[0006] [DRY RUN] `1` images would be purged
INFO[0006] ----------------------------------------------------------------

Contributing

If you've found a bug or would like to contribute, please create an issue here on GitHub, or better yet fork the project and submit a pull request!

About

πŸ› A golang implementation for removing old images from ECR repositories

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages