获取远程的官方docker仓库标签tag
一、通过网站查询docker 远程的 tags
查询网址为: https://registry.hub.docker.com/v1/repositories/【镜像名】/tags 比如 centos 的所有镜像标签查询url为: https://registry.hub.docker.com/v1/repositories/centos/tags
二、通过bash脚本来获取远程的docker仓库标签tag
vim ~/bin/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}"
示例用法如下:
列出所有的php标签:dockertags php
列出php标签中,包含apache的所有标签:dockertags php apache
文章转载:https://www.liaoyongfu.com/2018/11/d0d9ca71-85b1-4976-8291-3f0efb8f7a8c/
文章目录
关闭