Skip to content

Instantly share code, notes, and snippets.

@AllanChain
Last active February 29, 2020 02:07
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save AllanChain/f24d5fad3be1129829c20fc0bc66a385 to your computer and use it in GitHub Desktop.
Save AllanChain/f24d5fad3be1129829c20fc0bc66a385 to your computer and use it in GitHub Desktop.
List docker image tags with 163 mirror
#!/bin/bash
# From https://stackoverflow.com/a/39454426/8810271
if [ $# -lt 1 ]
then
cat << HELP
dockertags -- list all tags for a Docker image on a remote registry.
EXAMPLE:
- list all tags for ubuntu:
dockertags ubuntu
- list all php tags containing apache:
dockertags php apache
HELP
exit
fi
image="$1"
tags=`curl https://hub-mirror.c.163.com/v2/library/${image}/tags/list | sed -e 's/.*\[//g' -e 's/"//g' -e 's/\]\}$//g' -e 's/,/\n/g'`
if [ -n "$2" ]
then
tags=` echo "${tags}" | grep "$2" `
fi
echo "${tags}"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment