docker - 获取远程 docker 存储库中编号最高的图像标签
问题描述
如何在远程注册表中远程确定具有最高标签的图像?无需拉下图像并查看它们。我需要它来处理经过身份验证的连接。
解决方案
我用 Perl 做到了。如此处所示:
tagslist = commands.getstatusoutput("curl -H \"Content-Type:application/json\" -k -s -u <U>:<P> https://docker-registry/v2/myrepo/tags/list")
n=json.dumps(tagslist)
o=json.loads(n)
m=o[1]
t=json.loads(m)
s=t['tags']
highest=-1
for i in s:
try:
iTag = int(i)
if iTag > highest:
highest=iTag
except ValueError:
val = 0
print highest
这对我来说效果很好。Gnu/Linux 上的 Python 2.7
推荐阅读
- ruby-on-rails - 我可以在没有 Gemfile 的情况下部署 rails 项目吗
- sql - SQL Server 存储过程的烦恼
- ios - 如何使 UITabBaItem 的图像和文本水平(并排)?
- node.js - 为什么控制台显示 Undefined ???
- json - 用 jq 重构 JSON 文件:重新组合数组中的值
- google-analytics - GA 分析报告 API 为许多指标返回 0,但界面显示数据
- excel - SelectSingleNode failure in VBA
- tomcat - 无法在 MyEclipse 中使用外部 Tomcat
- java - 如何在 Java 中转换序列
- python - 如何生成给定维度的计数“向量空间”,以某个整数为模