docker search 无法支持此需求,需要定义shell脚本实现。
新建脚本文件 docker-show-repo-tag.sh
#!/bin/sh
#
# Simple script that will display docker repository tags.
#
# Usage:
# $ docker-show-repo-tags.sh ubuntu centos
for Repo in $* ; do
curl -s -S "https://registry.hub.docker.com/v2/repositories/library/$Repo/tags/" | \
sed -e 's/,/,\n/g' -e 's/\[/\[\n/g' | \
grep '"name"' | \
awk -F\" '{print $4;}' | \
sort -fu | \
sed -e "s/^/${Repo}:/"
done
使用
// 授予脚本执行权限
$ chmod 744 ./docker-show-repo-tags.sh
// 使用
$ ./docker-show-repo-tags.sh centos
centos:7
centos:7.9.2009
centos:8.4.2105
centos:centos6
centos:centos6.10
centos:centos7
centos:centos7.9.2009
centos:centos8
centos:centos8.4.2105
centos:latest
附
-
官方认证的仓库url
https://registry.hub.docker.com/v2/repositories/library/$Repo/tags/
$Repo
eg: ubuntu -
个人仓库url
https://registry.hub.docker.com/v2/repositories/$User/$Repo/tags/
$User/$Repo
eg: jenkins/jenkins
0 评论
大哥整点话呗~