Reputation: 785
docker pull jaegertracing/jaeger-agent:latest
Jaeger is just for illustration. But my question is more generic. The above command pulls the latest
version of the jaeger-agent
from docker-hub.
The docker-hub page for this is : https://hub.docker.com/r/jaegertracing/jaeger-agent
My question is how do I find the actual version of latest
?
I looked in to the tags here, but there is not much info : https://hub.docker.com/r/jaegertracing/jaeger-agent/tags
Also I tried doing an inspect
after pulling the image, but could not get necessary details.
docker image inspect jaegertracing/jaeger-agent:latest
Where can we get this information from ?
Upvotes: 60
Views: 61882
Reputation: 71
A quite common situation is when you pulled a latest version of a docker image some time ago. Meanwhile the maintainer of the docker image could have pushed several new versions. Thus even if your local image is tagged as latest, it is not necessarly still the case on the remote registry. It is even possible that your image does not match any tagged version at all on the remote registry.
Anyway there is a chance to get a match comparing the digest of your local image with those on your remote docker registry. I'm taking the example of Docker Hub in this post.
Get the digest of your local image, using docker inspect.
$ docker image inspect jaegertracing/jaeger-agent:latest | jq -r '.[].RepoDigests[]' | awk -F@ '{print $2}'
sha256:8b7ef48117ceb0c76210dbb19238000015e4017e53c8bd2bb3811a1dde0a777d`
Put the digest into a variable :
$ dig=$(!!)
Get the digest of the remote images and filter them using the previously recorded digest. To achieve it, let's use a REST API call to docker hub. More information at https://docs.docker.com/docker-hub/api/latest/#tag/repositories/paths/~1v2~1namespaces~1%7Bnamespace%7D~1repositories~1%7Brepository%7D~1tags~1%7Btag%7D/get
$ curl -s 'https://hub.docker.com/v2/repositories/jaegertracing/jaeger-agent/tags' -H 'Content-Type: application/json' | jq -r '.results[] | select(.digest == "'$dig'") | .name'
1.49
1.49.0
Here are the versions of the (identical) matching images on the remote registry. If the last command had returned an empty result, that would have meant that the local image does not match any version distributed on the remote registry.
Upvotes: 6
Reputation: 1
Search version
Example 1
docker image inspect nameimage:latest --format '{{ .Config.Env }}'
Example 2
docker image inspect imageID --format '{{ .Config.Env }}'
More detail with you context
docker image inspect jaegertracing/jaeger-agent:latest --format '{{ .Config.Env }}'
Good Luck :)!
Upvotes: 0
Reputation: 395
get the image id and then replace IMAGE_ID with it.
docker image inspect --format '{{json .}}' "$IMAGE_ID" | jq -r '. | {Id: .Id, Digest: .Digest, RepoDigests: .RepoDigests, Labels: .Config.Labels}'
Upvotes: 5
Reputation: 2771
There is an issue Digests on Dockerhub and those fetched by docker pull do not match not solved yet.
@peterevans's answer and this answer can help. https://stackoverflow.com/a/64309017/1543768
But if the machine can't install some tool easily, Created
is an easy tool to use.
$docker images
REPOSITORY TAG IMAGE ID CREATED SIZE
your-image latest 4b10e**** 22 months ago 15.1MB
$IMAGE_ID=4b10e
$docker image inspect --format '{{.Created }}' $IMAGE_ID
2020-11-15T18:39:27.727222621Z
Check the date with Dockerhub.
Upvotes: 0
Reputation: 41950
As @max-gasner mentioned, it's common for latest
to be tracking the master
branch of a git repository. This allows the engineers to quickly build and test images before they are released and version tagged. This is one of the reasons why it's not recommended to ever use latest
tags for anything critical where you need reproducibility.
jaegertracing/jaeger-agent:latest
doesn't have any other tags so the only way to determine which "version" of latest
you are using is to look at the digest. This uniquely identifies the image build. Tags actually resolve to digests. So when a new image is built with the latest
tag, that tag will then resolve to the digest of the new image.
DockerHub only shows the short version. You can inspect the full digest like this:
docker image inspect --format '{{.RepoDigests}}' jaegertracing/jaeger-agent:latest
> [jaegertracing/jaeger-agent@sha256:bacc749faba325fbe39dc13294c2222fb0babc9ecd344c25d9d577720a80b5ca]
Upvotes: 19
Reputation: 1256
latest
is just a tag like any other -- you will want docker image inspect
, which will give you information about the other tags on your image.
In the case of jaegertracing/jaeger-agent:latest
, it doesn't look this image has any other tags, so it's probable that this image is tracking something like the master branch of a source control repository, i.e., it doesn't correspond to a published version at all.
Upvotes: 6