How do I list images (tags) in a remote Google Cloud docker repo?

11/29/2018

I call this command to send my image to a repo.

docker push gcr.io/my-project/my-images:v1

It succeeds, as in fact I can apply a "Deployment" yaml and my new service is available at GKE.

My question: How do I list the images (tags) at that gcr.io repo address, to confirm that mine is there?

docker image list gives me the local list, but not the remote list.

gcloud --project=my-project container images list gives an empty result. (Yet, as stated, my image is out there.)

How can I get this list?

-- Joshua Fox
docker
gcloud
google-kubernetes-engine
kubernetes

2 Answers

11/29/2018

Replace my-project and my-image as appropriate and execute:

curl -sL https://gcr.io/v2/my-project/my-image/tags/list

With some jq command piping you can then get only what you need, if this is part of some automation.

Reference: Docker Registry HTTP API V2

I got "v1 Registry API is disabled" error in my tests trying the HTTP API v1 against gcr.io.

-- apisim
Source: StackOverflow

11/29/2018

Use --repository flag

 --repository=REPOSITORY
    The name of the repository. Format: *.gcr.io/repository. Defaults to
    gcr.io/<project>, for the active project.

This example will return all the available images:

gcloud container images list --repository=gcr.io/your-project
NAME
gcr.io/your-project/your-image
gcr.io/your-project/another-image
gcr.io/your-project/one-more-image

If you want to list all the tags for the specified image, run

gcloud container images list-tags gcr.io/your-project/your-image
DIGEST        TAGS     TIMESTAMP
0109315b26cf  5a9ad92  2018-11-15T13:24:56
98e2d1475275  343fca4  2018-11-15T11:35:52
df58b7269b89  d96aa6c  2018-11-14T17:11:18
47e93cb3a33f  7a9ff9d  2018-11-13T16:27:06
-- edbighead
Source: StackOverflow