栏目分类:
子分类:
返回
名师互学网用户登录
快速导航关闭
当前搜索
当前分类
子分类
实用工具
热门搜索
名师互学网 > IT > 面试经验 > 面试问答

如何在远程注册表上列出Docker映像的所有标签?

面试问答 更新时间: 发布时间: IT归档 最新发布 模块sitemap 名妆网 法律咨询 聚返吧 英语巴士网 伯小乐 网商动力

如何在远程注册表上列出Docker映像的所有标签?

我从这里得到了答案。非常感谢!:)

只需一行脚本:(找到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标签



转载请注明:文章转载自 www.mshxw.com
本文地址:https://www.mshxw.com/it/417400.html
我们一直用心在做
关于我们 文章归档 网站地图 联系我们

版权所有 (c)2021-2022 MSHXW.COM

ICP备案号:晋ICP备2021003244-6号