Search code examples
dockergcloudgoogle-kubernetes-enginegoogle-container-registry

How to list the published container images in the Google Container Registry using gcloud or another CLI


Is there a gcloud API or other command line interface (CLI) to access the list of published container images in the private Google Container Registry? (That is the container registry inside a Google Cloud Platform project)

gcloud container does not seem to help:

$ gcloud container
Usage: gcloud container [optional flags] <group | command>
  group may be           clusters | operations
  command may be         get-server-config

Deploy and manage clusters of machines for running containers.

flags:
  --zone ZONE, -z ZONE   The compute zone (e.g. us-central1-a) for the cluster

global flags:
  Run `gcloud -h` for a description of flags available to all commands.

command groups:
  clusters               Deploy and teardown Google Container Engine clusters.
  operations             Get and list operations for Google Container Engine
                         clusters.

commands:
  get-server-config      Get Container Engine server config.

I also don't want to use gcloud docker to list images because this wants to connect to a particular docker daemon that I don't have. Unless there is a way to tell gcloud docker to connect to a remote public docker daemon that can read the private containers pushed to the registry through my project.


Solution

  • We just released a new command to list the images in your repository! You can try it out with:

    gcloud alpha container images list --repository=gcr.io/$MYREPOSITORY
    

    If you want to see the specific tags for an image you can use:

    gcloud alpha container images list-tags gcr.io/$MYREPOSITORY/$MYIMAGE