Skip to content

Instantly share code, notes, and snippets.

@acoshift
Last active August 18, 2019 01:21
Show Gist options
  • Save acoshift/bb1db12539ffd0ac8ed0cbf520ec19ac to your computer and use it in GitHub Desktop.
Save acoshift/bb1db12539ffd0ac8ed0cbf520ec19ac to your computer and use it in GitHub Desktop.
Delete GCR old images (> 10)
gcloud container images list-tags --format=json gcr.io/$PROJECT_ID/$IMAGE | \
jq -r '.[].digest' | \
awk 'NR > 10 {print "gcr.io/$PROJECT_ID/$IMAGE@" $1}' | \
xargs -P 10 -n 10 gcloud container images delete -q --force-delete-tags
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment