6
docker如何获取hub.docker.com上的镜像标签
source link: https://www.wencst.com/archives/992
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.
docker如何获取hub.docker.com上的镜像标签
众所周知,查询docker镜像是
docker search centos
那么如何获取某个具体镜像的所有tag呢?
首先新建dockertags.sh文件,内容如下:
#!/bin/bash function usage() { 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 } if [ $# -lt 1 ]; then usage exit fi image="$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" ` fi echo "${tags}"
将dockertags.sh增加可执行权限,并放入/usr/bin,使用方法:
dockertags centos
列出centos标签中,包含7的所有标签:
dockertags centos 7
如果文章对您有用,扫一下支付宝的红包,不胜感激!
欢迎加入QQ群进行技术交流:656897351(各种技术、招聘、兼职、培训欢迎加入)
Leave a Reply Cancel reply
You must be logged in to post a comment.
Recommend
About Joyk
Aggregate valuable and interesting links.
Joyk means Joy of geeK