如何列出 ECR 注册表中的图像

kak*_*aka 7 aws-cli amazon-ecr

我想列出 ECR 注册表中的图像,但出现一些错误。有人可以提供解决方案吗?

aws ecr list-images --repository-name <Repository_Name>
Run Code Online (Sandbox Code Playgroud)

下面出现错误

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'

Run Code Online (Sandbox Code Playgroud)

注意:我想列出存储库中的所有图像,但我不想使用过滤器列出图像。

Adi*_*iii 5

从错误来看,您似乎插入了无效的存储库名称或者您正在查找错误的区域

aws ecr list-images --repository-name VALID_REPO_NAME --region us-west-2
Run Code Online (Sandbox Code Playgroud)

或者您可以使用此脚本从所有存储库获取所有图像。

#!/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
Run Code Online (Sandbox Code Playgroud)

aws-cli-备忘单