Reputation: 383
I am looking to fetch images that are available gcr using a gcloud API.
I have tried GET https://compute.googleapis.com/compute/v1/projects/myproject/global/images/myimage
but I wont get anything back.
If I remove remove /myimage
from the call above, I get some images back but not the images on the GCR as compute returns GCE images.
I found https://gcr.io/v2/myproject/myimage/tags/list
which does return the data I expect. But using this is not an option for me.
Is there an actual google API that returns something similar as the SDK gcloud container images describe gcr.io/myproject/myimage
or as https://gcr.io/v2/myproject/myimage/tags/list
?
Upvotes: 0
Views: 1367
Reputation: 40336
Google Container Registry (GCR) implements the Docker Registry HTTP API V2 for image management.
See Google's docs for Container Registry: Docker Registry API.
You can confirm this to yourself by running any of the gcloud container images
sub-commands with the --log-http
flag to show the underlying REST API calls e.g.
gcloud container images list --log-http
You may find it useful to use commands like the above as an exemplar for using the API w/ GCR
It is useful that Google chose to implement Docker's API because it means that you can use e.g. docker
, podman
and any other existing tools that talk to the Docker API to interact with GCR.
The downside is that the API is not a Google API and so requires understanding Docker's methodology. In my experience, the APIs' a little gnarly.
Upvotes: 4