$ gcloud container images list-tags gcr.io/chetabahana/backend
7d6ce698cce2 latest 2019-04-12T14:13:16
7c077a9ca45a 2019-04-12T14:00:38
$ gcloud container images delete --quiet gcr.io/chetabahana/backend@DIGEST
ERROR: (gcloud.container.images.delete) [gcr.io/chetabahana/backend@DIGEST] \
DIGEST must be of the form "sha256:<digest>
$ DIGEST=`gcloud container images list-tags gcr.io/chetabahana/backend \
--filter='-tags:*' --format='get(digest)'`
$ echo $DIGEST
sha256:7c077a9ca45aea7134d8436a3071aceb5fa62758cc86eadec63f02692b7875f7
$ [ -z "$DIGEST" ] && echo "No digest" || gcloud container images delete \
--quiet gcr.io/chetabahana/backend@$DIGEST
Digests:
- gcr.io/chetabahana/backend@sha256:7c077a9ca45aea7134d8436a3071aceb5fa62758cc86.....
Deleted [gcr.io/chetabahana/backend@sha256:7c077a9ca45aea7134d8436a3071aceb5fa62.....
$ gcloud container images list-tags gcr.io/chetabahana/backend
DIGEST TAGS TIMESTAMP
7d6ce698cce2 latest 2019-04-12T14:13:16
$ gcloud container images list-tags gcr.io/${PROJECT_ID/${IMAGE} \
--filter='-tags:*' --format='get(digest)' --limit=unlimited |
awk '{print "gcr.io/${PROJECT_ID}/${IMAGE}@" $1}' |
xargs gcloud container images delete --quiet
Digests:
- gcr.io/chetabahana/backend@sha256:7c077a9ca45aea7134d8436a3071aceb5fa62758cc86.....
Deleted [gcr.io/chetabahana/backend@sha256:7c077a9ca45aea7134d8436a3071aceb5fa62.....