Skip to content

Instantly share code, notes, and snippets.

@ThanosDi
Last active August 27, 2019 07:20
Show Gist options
  • Save ThanosDi/59341144d9a1d4140bd4d93d8f618bcc to your computer and use it in GitHub Desktop.
Save ThanosDi/59341144d9a1d4140bd4d93d8f618bcc to your computer and use it in GitHub Desktop.
Mass delete azure docker repositories based on tag
# This will delete all tags starting with what you type in the tag. For example if you type v2 it will delete all tags v2.x.x
az acr repository show-tags -n <registry-name> --repository <repository-name> | grep \"<tag> | sed 's/,*$//g' | xargs -I X az acr repository delete -n <registry-name> --image <repository-name>:X --yes
#output
#This operation will delete the manifest 'sha256:xxxxxxxxxxxxx' and all the following images: '<repository-name>:v2.0.0-alpha'
#This operation will delete the manifest 'sha256:xxxxxxxxxxxxx' and all the following images: '<repository-name>:v2.1.0'
#This operation will delete the manifest 'sha256:xxxxxxxxxxxxx' and all the following images: '<repository-name>:v2.2.0'
#This operation will delete the manifest 'sha256:xxxxxxxxxxxxx' and all the following images: '<repository-name>:v2.3.0'
#This operation will delete the manifest 'sha256:xxxxxxxxxxxxx' and all the following images: '<repository-name>:v2.4.0'
#This operation will delete the manifest 'sha256:xxxxxxxxxxxxx' and all the following images: '<repository-name>:v2.4.1'
#This operation will delete the manifest 'sha256:xxxxxxxxxxxxx' and all the following images: '<repository-name>:v2.4.2'
#This operation will delete the manifest 'sha256:xxxxxxxxxxxxx' and all the following images: '<repository-name>:v2.4.3'
#This operation will delete the manifest 'sha256:xxxxxxxxxxxxx' and all the following images: '<repository-name>:v2.4.4'
#This operation will delete the manifest 'sha256:xxxxxxxxxxxxx' and all the following images: '<repository-name>:v2.5.0'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment