diff options
Diffstat (limited to 'tools')
-rwxr-xr-x | tools/docker/dktags | 29 |
1 files changed, 29 insertions, 0 deletions
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 @@ | |||
1 | #!/bin/bash | ||
2 | |||
3 | # Orignally copied from https://stackoverflow.com/a/39454426/7051075 | ||
4 | |||
5 | if [ $# -lt 1 ] | ||
6 | then | ||
7 | cat << HELP | ||
8 | |||
9 | dktags -- list all tags for a Docker image on a remote registry. | ||
10 | |||
11 | EXAMPLE: | ||
12 | - list all tags for ubuntu: | ||
13 | dktags ubuntu | ||
14 | |||
15 | - list all php tags containing apache: | ||
16 | dktags php apache | ||
17 | |||
18 | HELP | ||
19 | fi | ||
20 | |||
21 | image="$1" | ||
22 | 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}'` | ||
23 | |||
24 | if [ -n "$2" ] | ||
25 | then | ||
26 | tags=` echo "${tags}" | grep "$2" ` | ||
27 | fi | ||
28 | |||
29 | echo "${tags}" | ||