aboutsummaryrefslogtreecommitdiffhomepage
path: root/tools
diff options
context:
space:
mode:
Diffstat (limited to 'tools')
-rwxr-xr-xtools/docker/dktags29
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
5if [ $# -lt 1 ]
6then
7cat << HELP
8
9dktags -- list all tags for a Docker image on a remote registry.
10
11EXAMPLE:
12 - list all tags for ubuntu:
13 dktags ubuntu
14
15 - list all php tags containing apache:
16 dktags php apache
17
18HELP
19fi
20
21image="$1"
22tags=`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
24if [ -n "$2" ]
25then
26 tags=` echo "${tags}" | grep "$2" `
27fi
28
29echo "${tags}"