this post was submitted on 05 Apr 2024
9 points (100.0% liked)

Docker

1095 readers
1 users here now

founded 1 year ago
MODERATORS
 

I've been thinking about writing a script that would alert me if there was an updated version of an image I was running.

DockerHub shows an image digest on the page for that tag:

And I can extract the digest for an image I am running with:

docker inspect --format='{{index .RepoDigests 0}}' jc21/nginx-proxy-manager:latest

This matches the one from the DockerHub screenshot. But I can't see a CLI way to get the image digest from a registry. It seems like:

docker manifest inspect jc21/nginx-proxy-manager:latest

should do it, but it pulls out the digest of each of the architecture builds for that tag instead of the one shown in dockerhub.

Is there a way to compare the current local image with one in a registry from the command line? Or perhaps there's a more sensible way to do this?

top 1 comments
sorted by: hot top controversial new old
[–] [email protected] 2 points 6 months ago

For anyone coming to this later, digests are not presented in a super-understandable way (there's a good explanation of them in this stack-overflow). There appears to be two ways to get the digest that matches the one on the DockerHub page for the tag:

  • pull the image (what I was trying to avoid)
  • use API 2 (requires a token)

There's a good discussion of options for finding out if images have been updated in this r/SelfHosted discussion which is what I was trying to achieve.