how to list images from ECR Registry

Viewed 6389

I wanted to list images from ECR registry, but getting some error. Can someone provide the solution?

aws ecr list-images --repository-name <Repository_Name>

Got error below

An error occurred (RepositoryNotFoundException) when calling the 
ListImages operation: The repository with name '<Repository_Name>' does 
not exist in the registry with id 'ID_Name'

Note: I want to list all the images from repository, but I don't want to list the images using filter.

1 Answers

From the error, it seems you insert invalid repository name or you are looking in wrong region

aws ecr list-images --repository-name VALID_REPO_NAME --region us-west-2

OR you can get all images from all repository using this script.

#!/bin/sh
REPO_LIST=$(aws ecr describe-repositories --query "repositories[].repositoryName" --output text --region us-west-2);
for repo in $REPO_LIST; do
    echo "list image for $repo"
        aws ecr list-images --repository-name $repo --region us-west-2
done

aws-cli-cheatsheet

Related