Created
August 7, 2019 11:09
-
-
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 .
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
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