Skip to content

Instantly share code, notes, and snippets.

@utarn
Last active February 4, 2020 23:20
Show Gist options
  • Save utarn/61da39fd8c62410a1718802e1bda9bde to your computer and use it in GitHub Desktop.
Save utarn/61da39fd8c62410a1718802e1bda9bde to your computer and use it in GitHub Desktop.
Google cloud script to manage container registry : Quick Remove
#!/bin/bash
#TODAY=$(date --date="yesterday" +%Y-%m-%d)
IMAGE=${1}
TODAY=$(gcloud container images list-tags asia.gcr.io/utarndocker/${IMAGE} | tail -n +2 | head -1 | cut -f3 -d" " | cut -f1 -d"-")
NORMALIZE_TODAY=${TODAY:0:4}-${TODAY:4:2}-${TODAY:6:2}
gremove $IMAGE $NORMALIZE_TODAY
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment