I would like to know the CLI command to delete all images in an ECR repo.
Question posted in Amazon Web Sevices
The official Amazon Web Services documentation can be found here.
The official Amazon Web Services documentation can be found here.
2
Answers
According Amazon ECR Documentation – To delete an image (AWS CLI):
You can list the all images in your repository. Using this command line:
Then, you can iterate to delete all images using this command
Or to delete multiple images, you can specify multiple image tags or image digests in the request.
Here is a bash script (
delete.sh
) that you can delete any images from your ECR repository:You can execute by a single command like this:
with the following values:
ap-southeast-1
is my AWS Regionmy-ecr-repo
is my ECR repo nameReferences: