我从这里得到了答案。非常感谢!:)
只需一行脚本:(找到debian的所有标签)
wget -q https://registry.hub.docker.com/v1/repositories/debian/tags -O - | sed -e 's/[][]//g' -e 's/"//g' -e 's/ //g' | tr '}' 'n' | awk -F: '{print $3}'更新感谢@degelf的建议。这是shell脚本。
#!/bin/bashif [ $# -lt 1 ]thencat << HELPdockertags -- 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 apacheHELPfiimage="$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" `fiecho "${tags}"你可以创建一个新的文件名,
dockertags,在/ usr / local / bin目录(或添加PATH环境到你的
.bashrc/
.zshrc),并把这些代码在里面。然后添加可执行权限(
chmod +x dockertags)。
用法:
dockertags ubuntu-–>列出ubuntu的所有标签
dockertags php apache-–>列出所有包含’apache’的php标签



