Skip to content

Instantly share code, notes, and snippets.

@benc-uk
Last active April 24, 2022 08:33
Show Gist options
  • Save benc-uk/9441e2658a3605be79382dc77bb3bbd6 to your computer and use it in GitHub Desktop.
Save benc-uk/9441e2658a3605be79382dc77bb3bbd6 to your computer and use it in GitHub Desktop.
Docker & Containers

Docker & Containers

!/bin/bash
#
# Removes all matching tags from an ACR repo
# params: {acr-name} {image-repository} {tag}
#
az acr repository show-tags -n $1 --repository $2 -o tsv | while read img ; do
if [[ $img = *"$3"* ]]; then
echo "Deleting image $2:$img ..."
az acr repository delete -n $1 --image $2:$img --yes
fi
done
alias docker-prune='docker container prune -f && docker image prune -f && docker volume prune -f && docker buildx prune -f'
alias docker-clean='docker rm -f $(docker ps -a -q)'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment