aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorHsieh Chin Fan <typebrook@gmail.com>2022-04-05 18:03:51 +0800
committerHsieh Chin Fan <typebrook@gmail.com>2022-04-05 18:03:51 +0800
commit5456eb312fbcfde82c909789f02aa114a54f0957 (patch)
tree3e1f9eec75b2ac78bf744a4bcfa8ae5c1fe25505
parent13e4cd409373a1ab9cc2f574c286582eef6cbe51 (diff)
update
-rw-r--r--.signature2
-rwxr-xr-xtools/docker/dktags29
2 files changed, 30 insertions, 1 deletions
diff --git a/.signature b/.signature
index 06e1e27..157a477 100644
--- a/.signature
+++ b/.signature
@@ -1 +1 @@
謝晉凡 Hsieh Chin Fan | https://topo.tw 謝晉凡 Hsieh Chin Fan | https://topo.tw/about
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}"