Last active
June 17, 2024 02:43
-
-
Save itaysk/c023de03fe74dd3d5db336b7f9699b6b to your computer and use it in GitHub Desktop.
Get latest (highest) version of a Docker Hub image
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
curl -L --fail "https://hub.docker.com/v2/repositories/${DOCKERHUB_REPO}/${DOCKERHUB_IMAGE}/tags/?page_size=1000" | \ | |
jq '.results | .[] | .name' -r | \ | |
sed 's/latest//' | \ | |
sort --version-sort | \ | |
tail -n 1 |
Thank you sir, I'm using it in my project and it works well (https://github.com/mmaous/sftp/blob/7c974165a25a34fd415d01637912e2b6b8b642bb/.github/workflows/docker-main.yml#L39)
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Thanks for this!