Skip to content

Instantly share code, notes, and snippets.

@geunho
Created April 3, 2019 02:24
Show Gist options
  • Save geunho/e86595d5805171be8a8f5a40e0c79743 to your computer and use it in GitHub Desktop.
Save geunho/e86595d5805171be8a8f5a40e0c79743 to your computer and use it in GitHub Desktop.
docker get image digest
# get digest
digest=$(docker inspect --format='{{index .RepoDigests 0}}' $registry/$image:$tag)
# parse sha (split as '@' and get second one
sha=$(echo $digest | cut -d'@' -f2)
# or one line
sha=$(docker inspect --format='{{index .RepoDigests 0}}' $registry/$image:$tag | cut -d'@' -f2)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment