我想删除所有未标记的 ecr 图像
import boto3
import pprint
s3 = boto3.resource('s3')
for bucket in s3.buckets.all():
print(bucket.name)
pp = pprint.PrettyPrinter(indent=4)
client = boto3.client('ecr', region_name='us-west-2')
response = client.describe_repositories(repositoryNames=['localstack-centos'])
#print(response)
""" response1 = client.describe_images(
repositoryName='localstack-centos',
#maxResults=2,
imageIds=[
{
'imageTag': 'untagged'
},
],
) """
#print(response1)
response2 = client.list_images(
repositoryName='localstack-centos',
maxResults=123,
filter={
'tagStatus': 'UNTAGGED'
}
)
print(response2)
pp.pprint(response2)
response = client.batch_delete_image(
registryId='string',
repositoryName='localstack-centos',
imageIds=[
{
'imageTag': 'untagged'
},
]
)
如果我将 'untagged' 替换为 latest ,我可以列出所有 ecr 图像,但无法删除“未标记”图像,该图像被删除我将如何引用所有未标记图像