Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How do I list images and tags in google container registry

Looking for a way to use the gcloud commandline to get the tags of container engine registry images.

this command cloud docker search gcr.io/PROJECT/myimage returns NAME DESCRIPTION STARS OFFICIAL AUTOMATED PROJECT/myimage 0 but i want to see the tags used so far like the gcloud web console shows.

enter image description here

the machine I run this command on pulls images from docker hub, tags them, then pushes them to google container engine with gcloud docker push...

I suspect I may be asking how to make the local docker client do commands against both google repo and docker hub repo so I can get docker images listings

****** UPDATE: see https://stackoverflow.com/a/38061253/201911 for this capability in the latest release.

like image 511
navicore Avatar asked Apr 06 '16 15:04

navicore


People also ask

How do I push the Docker image to the Google Container Registry?

Tag image with registry name This configures the docker push command to push the image to a specific location. The registry name format is: gcr.io/[PROJECT-ID]/[IMAGE] where [PROJECT-ID] is your Google Cloud Platform Console project ID and [IMAGE] is your image's name. You are now ready to push your image to GCR!


3 Answers

Let me tell you hack to relieve your pain:

ZONE=eu
PROJECT_ID=testproject
PROJECT_URL=gs://${ZONE}.artifacts.${PROJECT_ID}.appspot.com/containers/repositories/library

# this generates images list
gsutil ls $PROJECT_URL | sed -e 's#/$##' -e 's#.*/##' 

IMAGE_URL=gs://${ZONE}.artifacts.${PROJECT_ID}.appspot.com/containers/repositories/library/${IMAGE_NAME}/

# this generates tags list for specified image
gsutil ls $IMAGE_URL | sed -n '/\/tag_/ { s#.*/tag_##p }'

This will serve you in most of the cases. You will need read permissions to list files in that specific storage bucket in GCE.

like image 186
Gaspar Chilingarov Avatar answered Oct 08 '22 12:10

Gaspar Chilingarov


gcloud container images list-tags gcr.io/PROJECT/myimage https://cloud.google.com/sdk/gcloud/reference/container/images/list-tags

like image 25
johnmcs Avatar answered Oct 08 '22 12:10

johnmcs


This is not currently possible with gcloud. gcloud docker is just a wrapper around the docker command line tool, which doesn't easily expose the information you'd like for remote repositories.

At some point in the future, gcloud may support this feature.

like image 31
Zachary Newman Avatar answered Oct 08 '22 11:10

Zachary Newman