6

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.

Adiii
  • 54,482
  • 7
  • 145
  • 148
kaka
  • 143
  • 1
  • 4
  • 13

1 Answers1

4

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

Adiii
  • 54,482
  • 7
  • 145
  • 148
  • Adiii@ Thanks for your responce. I can able to push the images to the same repository which I mentioned, but unable to list the images using below command. aws ecr list-images --repository-name .dkr.ecr.us-east-1.amazonaws.com/ --region us-west-1 – kaka Jul 10 '20 at 12:45
  • No, the parameter expecting repository name, not the ID, it should be like `stage/nodejs` etc – Adiii Jul 10 '20 at 12:46
  • 1
    it will not contain `12334.dkr.ecr.us-west-2.amazonaws.com/stage/nodejs`, you just need to pass `stage/nodejs` – Adiii Jul 10 '20 at 12:48
  • My repository URI is below. .dkr.ecr.us-east-1.amazonaws.com/hello. Could please tell me what needs to be passed in below command. aws ecr list-images --repository-name --region us-west-1 – kaka Jul 10 '20 at 13:10
  • Just pass hello – Adiii Jul 10 '20 at 13:17
  • can you try the complete script? – Adiii Jul 10 '20 at 13:49
  • just passing the repo name not working in my case as well – asmath Jun 18 '23 at 06:33
  • @asmath can you show your command and make sure you are passing the region? – Adiii Jun 19 '23 at 03:27
  • @Adiii using this below command aws ecr list-images --repository-name "demo" --region us-east-1 – asmath Jun 25 '23 at 08:44