Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to delete image from Azure Container Registry

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

like image 932
rgomesf Avatar asked Jan 03 '17 15:01

rgomesf


People also ask

How do I delete photos from Azure registry container?

To delete by tag, use az acr repository delete and specify the image name in the --image parameter. All layers unique to the image, and any other tags associated with the image are deleted.

How do I delete an Azure container instance?

Deleting an Azure Container Instance (ACI)The "az container delete" command will wait for your input in order to delete the container. There is no immediate action unless you confirm, which makes a lot of sense for obvious reasons Microsoft doesn't want users to delete containers by mistake.


3 Answers

UPDATE COPIED FROM BELOW:

As an update, today we've released a preview of several features including repository delete, Individual Azure Active Directory Logins and Webhooks.

Original answer:

We are hardening up the registry for our GA release later this month. We've deferred all new features while we focus on performance, reliability and additional azure data centers, delivering ACR across all public data centers by GA. We will provide deleting of images and tags in a future release. We're started to use https://github.com/Azure/acr/ to track features and bugs. Delete is captured here: https://github.com/Azure/acr/issues/33

Thanks for the feedback, Steve

like image 82
Steve Lasker Avatar answered Oct 19 '22 16:10

Steve Lasker


You can use Azure CLI 2.0 to delete images from a repository with a given tag:

az acr repository delete -n MyRegistry --repository MyRepository --tag MyTag

  • MyRegistry is the name of your Azure Container Registry
  • MyRepository is the name of the repository
  • MyTag denotes the tag you want to delete.

You can also choose to delete the whole repository by omitting --tag MyTag. More information about the az acr repository delete command can be found here: https://learn.microsoft.com/en-us/cli/azure/acr/repository#delete

like image 9
christianliebel Avatar answered Oct 19 '22 15:10

christianliebel


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.

like image 9
Alexander van Trijffel Avatar answered Oct 19 '22 16:10

Alexander van Trijffel