Unable to delete local registry images in GKE

1/9/2019

For the list of docker images that is displayed in GKE, I am trying to delete unwanted ones in my GKE console but getting error.

As suggested in this link https://cloud.google.com/sdk/gcloud/reference/container/images/delete I am trying to run it but getting error.

For example, I am tring to delete mynginx image.

xxx@cloudshell:~ (involuted-ratio-227118)$ gcloud container images delete mynginx --force-delete-tags --quiet
ERROR: (gcloud.container.images.delete) [mynginx:latest] digest must be of the form "sha256:<digest>".
xxx@cloudshell:~ (involuted-ratio-227118)$ gcloud container images delete --quiet cs-6000-devshell-vm-37ed1cd7-726d-48bc-85df-8ce82c65f035/involuted-ratio-227118/mynginx@DIGEST
ERROR: (gcloud.container.images.delete) [cs-6000-devshell-vm-37ed1cd7-726d-48bc-85df-8ce82c65f035/involuted-ratio-227118/mynginx@DIGEST] digest must be of the form "sha256:<digest>".

Any help is appreciated. Thanks

-- Gopi
docker
google-cloud-platform
google-compute-engine
google-kubernetes-engine

1 Answer

1/9/2019

From the documentation,

"The fully qualified name(s) of image(s) to delete. The name(s) should be formatted as *.gcr.io/PROJECT_ID/IMAGE_PATH@sha256:DIGEST or *.gcr.io/PROJECT_ID/IMAGE_PATH:TAG."

The image names must be in the above format. Also, you need to replace the word DIGEST with the image's sha256 digest. You can get the digest using command like

docker images --digests | grep {IMAGE NAME}

Where {IMAGE NAME} is the name of the image. Documentation here.

-- xavierc
Source: StackOverflow