0

How to get sha's of all the tags corresponding to an image on docker hub. For instance, consider an image with latest, latest-windows and latest-linux tags. On docker pull image_name:latest, docker will automagically pull the correct image based on the OS from which the command is being run.

How can I get the SHA's for all the three tags. I found that we can do it using manifest-tool. Is there a way we can do this by using only docker.

EDIT:

docker inspect image_name:tag will return the sha of only one of the tags either windows or linux depending on the operating system.

Shubham
  • 3,071
  • 3
  • 29
  • 46
  • Possible duplicate of [Where can I find the sha256 code of a docker image?](https://stackoverflow.com/questions/32046334/where-can-i-find-the-sha256-code-of-a-docker-image) – callmemath Mar 21 '19 at 19:17
  • Not a duplicate. Added an edit explaining. – Shubham Mar 21 '19 at 19:20
  • latest-windows and latest-linux aren't official tags. You can run the command 3 times and check the difference using bash. Also, it seems odd to use latest-windows and latest-linux tags as docker is build to run on multiple os using the same image. Maybe you should reconsider your idea – callmemath Mar 21 '19 at 19:30

1 Answers1

1

It's unbelievable how hard it is to find the multiarch SHA for a given tag.

Since I spend 15-20 minutes every time trying to remember how myself, I'm documenting it here for others.

This is not the official way to do it (what is the official way?), but this has reliably worked for me (using a ruby image as my example):

docker run mplatform/manifest-tool inspect ruby:3.1.2-alpine3.15
Bo Jeanes
  • 6,294
  • 4
  • 42
  • 39