Skip to content

Instantly share code, notes, and snippets.

@ederparaiso
Created October 20, 2019 23:01
Show Gist options
  • Save ederparaiso/45073fac54509b3ebc718b57803265b3 to your computer and use it in GitHub Desktop.
Save ederparaiso/45073fac54509b3ebc718b57803265b3 to your computer and use it in GitHub Desktop.
Purge untagged container images in Azure Container Registry
#!/bin/bash
# WARNING! This script deletes data!
# Purge untagged (orphaned) images
REGISTRY=your_registry
REPOSITORY=your_repository
az acr repository show-manifests --name $REGISTRY --repository $REPOSITORY --query "[?tags[0]==null].digest" -o tsv \
| xargs --replace=digest --verbose az acr repository delete -n $REGISTRY --image $REPOSITORY@digest --yes
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment