Created
December 16, 2022 23:18
-
-
Save moroz/5c45c04afefcacea256f1e40fcdb8126 to your computer and use it in GitHub Desktop.
Empty an ECR repository
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
# Implies that AWS_PROFILE and AWS_REGION are set | |
aws ecr list-images --repository-name $1 \ | |
| jq -r '.imageIds[].imageTag' \ | |
| xargs printf -- 'imageTag=%s\n' \ | |
| xargs aws ecr batch-delete-image --repository-name $1 --image-ids |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment