How to delete image from Azure Container Registry

后端 未结 8 978
佛祖请我去吃肉
佛祖请我去吃肉 2020-12-29 09:13

Is there a way to delete specific tags only? I only found a way to delete the whole registry using the REST/cli-acr

Thanks

8条回答
  •  再見小時候
    2020-12-29 09:37

    Here is a powershell script that deletes all Azure Container Registry tags except for tags MyTag1 and MyTag2:

    az acr repository show-tags -n MyRegistry --repository MyRepository | ConvertFrom-String | %{$_.P2 -replace "[`",]",""} | where {$_ -notin "MyTag1","MyTag2"  } | % {az acr repository delete -n MyRegistry --repository MyRepository --tag $_ --yes}
    

    It uses Azure CLI 2.0.

提交回复
热议问题