Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

API - image_id tag returns null #1490

Closed
lxwbr opened this issue Feb 25, 2016 · 3 comments
Closed

API - image_id tag returns null #1490

lxwbr opened this issue Feb 25, 2016 · 3 comments

Comments

@lxwbr
Copy link

lxwbr commented Feb 25, 2016

I am trying to retrieve the docker image ID through the API. Using following URL:

https://registry.hub.docker.com/v2/repositories/mesosphere/marathon/tags/v0.11.1/

I am getting this result back:

{"name": "v0.11.1", "full_size": 536893184, "id": 1118232, "repository": 60768, "creator": 372823, "last_updater": 77974, "last_updated": "2015-11-04T16:30:33.343998Z", "image_id": null, "v2": true}

The desired image_id tag is null, but it should be a 12 char string. How do I get it?

@RichardScothern
Copy link

@Alexanderweber the url does not actually go directly to the v2 registry (though the URL confusingly indicates that it does).

What is your use case for getting the image_id? The registry will return a manifest for an image, the contents of which are described here

@mkrogh
Copy link

mkrogh commented Jan 17, 2017

Hey sorry to poke at this almost a year after it was closed.

But my use case for the getting the image_id is to do cross checks against images running on a machine to see if a newer image is available (and if so signal it).

E.g. using: curl --unix-socket /var/run/docker.sock http://localhost/images/json to get the images on the machine, then cross reference these with docker hub (or private repository).

It might be that there is a better way to check for updates to images running (that does not involve running docker pull).

@dmcgowan
Copy link
Collaborator

@mkrogh in the future please open up new issues even to ask questions rather than commenting on older issues.

Since Docker 1.12 every image pulled from a registry will have a digest saved, in the JSON, look for the "RepoDigests" field in the returned elements. You can compare this with the "Docker-Content-Digest" field returned by the registry when hitting the manifests endpoint with the tag. If the digest returned from the manifests endpoint is not in the "RepoDigests" field, then there is an update. I might also consider using notary and Docker Content Trust if running a private registry, you would compare the digest returned by notary rather than the digest returned by the manifests endpoint.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants