From 5456eb312fbcfde82c909789f02aa114a54f0957 Mon Sep 17 00:00:00 2001 From: Hsieh Chin Fan Date: Tue, 5 Apr 2022 18:03:51 +0800 Subject: update --- tools/docker/dktags | 29 +++++++++++++++++++++++++++++ 1 file changed, 29 insertions(+) create mode 100755 tools/docker/dktags (limited to 'tools') diff --git a/tools/docker/dktags b/tools/docker/dktags new file mode 100755 index 0000000..5a91434 --- /dev/null +++ b/tools/docker/dktags @@ -0,0 +1,29 @@ +#!/bin/bash + +# Orignally copied from https://stackoverflow.com/a/39454426/7051075 + +if [ $# -lt 1 ] +then +cat << HELP + +dktags -- list all tags for a Docker image on a remote registry. + +EXAMPLE: + - list all tags for ubuntu: + dktags ubuntu + + - list all php tags containing apache: + dktags php apache + +HELP +fi + +image="$1" +tags=`wget -q https://registry.hub.docker.com/v1/repositories/${image}/tags -O - | sed -e 's/[][]//g' -e 's/"//g' -e 's/ //g' | tr '}' '\n' | awk -F: '{print $3}'` + +if [ -n "$2" ] +then + tags=` echo "${tags}" | grep "$2" ` +fi + +echo "${tags}" -- cgit v1.2.3-70-g09d2