Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/amazon-web-services/13.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/7/css/41.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Amazon web services AWS CLI,列出我用标记指定的ECR图像_Amazon Web Services_Aws Cli_Aws Ecr - Fatal编程技术网

Amazon web services AWS CLI,列出我用标记指定的ECR图像

Amazon web services AWS CLI,列出我用标记指定的ECR图像,amazon-web-services,aws-cli,aws-ecr,Amazon Web Services,Aws Cli,Aws Ecr,假设“foo”是存储库的名称,我想把这个有两个标签的图像称为“boo,boo-0011” 此命令显示存储库中的所有图像: aws ecr描述图像--存储库名称foo--查询“排序依据(imageDetails和imagePushedAt)[*].imageTags[*]” 因此,我如何仅对具有标记“boo”的图像进行grep您可以使用--filter tagStatus=xxx但这只允许您对标记或未标记的图像进行过滤,而不允许对具有特定标记的图像进行过滤 要查找带有特定标记的图像,例如boo,您

假设“foo”是存储库的名称,我想把这个有两个标签的图像称为“boo,boo-0011”

此命令显示存储库中的所有图像:

aws ecr描述图像--存储库名称foo--查询“排序依据(imageDetails和imagePushedAt)[*].imageTags[*]”

因此,我如何仅对具有标记“boo”的图像进行grep

您可以使用
--filter tagStatus=xxx
但这只允许您对标记或未标记的图像进行过滤,而不允许对具有特定标记的图像进行过滤

要查找带有特定标记的图像,例如
boo
,您应该能够使用有点难以理解但非常有用的实用程序。例如:

aws ecr describe-images \
    --region us-east-1 \
    --repository-name foo \
    --filter tagStatus=TAGGED \
    | jq -c '.imageDetails[] | select([.imageTags[] == "boo"] | any)'

就我个人而言,我使用grep来实现这一点

aws ecr describe-images --repository-name foo --query "sort_by(imageDetails,& imagePushedAt)[ * ].imageTags[ * ]" | grep -w 'boo'

-w是用于全字匹配的grep命令