Skip to content

Instantly share code, notes, and snippets.

@suzuki-shunsuke
Created August 7, 2019 11:09
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save suzuki-shunsuke/66e9c1f3ffd5a9d6e9bc49371dcba5fa to your computer and use it in GitHub Desktop.
Save suzuki-shunsuke/66e9c1f3ffd5a9d6e9bc49371dcba5fa to your computer and use it in GitHub Desktop.
The shell function to list Docker image tags. It depends on https://github.com/genuinetools/reg .
dctag() {
if [ $# -eq 0 -o "$1" = "help" -o "$1" = "--help" -o "$1" = "-help" ]; then
cat << EOS
List Docker image tags
Usage: $ dctag <image name>
ex. $ dctag alpine
EOS
return 0
fi
if [ $# -ne 1 ]; then
cat << EOS >&2
Too many arguments
For help, please run 'dctag help'
EOS
return 1
fi
reg tags "$1" | grep ".*\..*" | sort -rV
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment