GCR using CLI to retrieve tagless images

741 Views Asked by At

I know you can do the following to retrieve a list of tags of a specific image:

gcloud container images list --repository=gcr.io/myproject

But I was wondering whether I can also use the gcloud CLI to retrieve the images without a tag.

The tag-less images are shown in the Google cloud console web interface.

Solution

gcloud container images list-tags gcr.io/myproject/repo --filter='-tags:*'

2

There are 2 best solutions below

1
On BEST ANSWER

list-tags would be better for your needs. Specifically, if you want to see information on all images (including untagged ones):

gcloud container images list-tags gcr.io/project-id/repository --format=json

And if you want to print the digests of images which are untagged:

gcloud container images list-tags gcr.io/project-id/repository --filter='-tags:*' --format='get(digest)' --limit=$BIG_NUMBER

0
On

I think what you are looking for is list-tags sub-command:

gcloud container images list-tags --repository=gcr.io/myproject/myrepo