Docker is amazing tool when it works and supports what you need. And it is a living hell, when it does not. It takes some amount of trying and searching to find working solution 🙂
Docker get integrated with Google Cloud and allows you to push and pull images to private repositories. But there is no easily found, documented way to list images that you have in a project in Google Cloud and what tags you have for each image.
You can see that information from Google Console, but there is no build-in docker command to do that.
Fetching image information from Google Container Registry
You need to have gcloud installed and authenticated.
- ZONE – with zone where your images are hosted (eu, us, asia)
- PROJECT_NAME – name of your project
- IMAGE_NAME – name of the docker image you want to explore
Getting list of images from GCR
curl -u “oauth2accesstoken:`gcloud auth print-access-token`” https://ZONE.gcr.io/v2/PROJECT_NAME/tags/list | json child | json -a
Getting list of tags for specific image from GCR
curl -u “oauth2accesstoken:`gcloud auth print-access-token`” https://ZONE.gcr.io/v2/PROJECT_NAME/IMAGE_NAME/tags/list | json tags | json -a
You will need to install utility json beforehand
npm install -g json