Created
July 2, 2022 19:19
-
-
Save achetronic/2db363e6c2fbecd42ae67512fbea50ca to your computer and use it in GitHub Desktop.
Find the tag of a Docker image having only the SHA256
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
SHA256_HASH="5bb4faffc8b35e2702b2ffa78e982b979d7b66db29bd55b0c58de8fa745df661" | |
for i in {1..1000} | |
do | |
echo "Looking into page: $i" | |
curl "https://registry.hub.docker.com/v2/repositories/apache/superset/tags/?page=$i" \ | |
| jq '.results[] | select(.["images"][]["digest"] == "sha256:'${SHA256_HASH}'")' | |
done |
To find your SHA256_HASH:
docker images --digests
@ThomDietrich @aryehb Thank you for the contribution mates!
This is used more as a life-saver trick when you only have the sha256 and you need to find the tag pointing to that digest in the repo to fix it in your deployment manifests
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
If you have the repo digest of the image (
docker inspect --format='{{index .RepoDigests 0}}' $IMAGE
), use thisjq
command:To hide the
curl
download stats, use--silent --show-error