0

I can get a hash of local docker image with

docker inspect --format='{{index .RepoDigests 0}}' myimage:latest

Can I get the same for a remote image? Something like

docker pull --hash-only cr.yandex/12345/myimage:latest

Or another thing that could solve my problem (pulling image on very low disk space machines): how to make docker pull auto delete old unused layers before pulling updated layers.

Jedi Knight
  • 367
  • 2
  • 10

2 Answers2

3

With docker itself:

$ docker buildx imagetools inspect busybox --format '{{json .Manifest.Digest}}'
"sha256:2376a0c12759aa1214ba83e771ff252c7b1663216b192fbe5e0fb364e952f85c"

External tools that implement this include Google's crane, RedHat's skopeo, and my own regclient.

BMitch
  • 231,797
  • 42
  • 475
  • 450
1

You can use skopeo for this,

Example: https://github.com/containers/skopeo/tree/main#show-properties-of-fedoralatest

Ali Kahoot
  • 3,371
  • 2
  • 22
  • 27