当前位置:网站首页>Practical skills: a key for image information in the Harbor, quick query image
Practical skills: a key for image information in the Harbor, quick query image
2022-08-09 09:40:00 【51CTO】
【摘要】
一键获取Harbor中的镜像列表,无需登录harbor UI,You can also download images in batches to the local and save them as tar包.
本文已参与「开源摘星计划」,欢迎正在阅读的你加入.
活动链接: https://github.com/weopenprojects/WeOpen-Star
前言
我们要查询Harbor中某个项目下某个镜像是否存在,需要登录Harbor UI管理界面,然后进入到项目(Project),再到搜索框输入镜像的名称来查找镜像在不在.
那么,如果只知道镜像的名称,不知道镜像在哪个项目(Project)呢?你是每个项目下都去搜索么?
那么!有什么方法可以简化这些操作呢?即:
- 不需要登录Harbor就可以看到Harbor里面所有的镜像;
- 仅提供镜像名称就可以看到镜像在哪个项目;
- 仅知道镜像名称就可以判断Harbor镜像仓库中是否存在这个镜像,从而判断上传的镜像是否上传成功.
我在工作中常遇到开发的同事的问题:
- 我上传一个镜像,帮忙看上传成功没?
- 我刚发布一个服务,构建的时候报错一直找不到镜像,这是什么原因?
- 我之前上传好几个版本的镜像,怎么知道都有哪些?
命令行获取Harbor镜像清单
在Harboron the service host,可通过如下命令在 registry Get a list of mirrors in the storage directory:
Shell脚本获取Harbor中所有的镜像列表
前面在harborThe service host command line is implementedharborGet the mirror list list.
那么,如果不是在HarborHow to get it on the service host?
通过调用Harbor API,Get all items first(Projects),Then loop to get the mirror names under each project,Recycle to get all of an imagetag版本,Finally output to an image manifest file in the specified format.
而Harbor的API有两个版本(v1、v2), 每个版本的APICalling methods are different.
3.1 查看API版本
3.2 Harbor V1 API的shell脚本
然后可以打开$FileSee the mirror list for the files in !
3.3 Harbor API v2版本的Shell脚本实现
Based on the mirror list will beHarborThe mirror image in is madetar包
前面通过shell脚本获取harbor中的镜像列表,并以
harbor地址:服务端口/项目名称/镜像名称:tag
format is output to a file.
Then you can batch according to this filepull镜像到本地,然后制作成tar包.
4.1 编写shell脚本
【原创声明】
本文为作者原创,It is being migrated to the WeChat public account one by one《Harbor进阶实战》.
边栏推荐
猜你喜欢
2048小游戏成品源码
Redis 回击 Dragonfly:13 年后,Redis 的架构依然是同类最佳
[Machine Learning] Basics of Data Science - Basic Practice of Machine Learning (2)
STM32F103实现IAP在线升级应用程序
常用命令之思科常用基础配置
.ts 音频文件转换成 .mp3 文件
Anti App so层对抗分析
Do you know the basic process and use case design method of interface testing?
.equals ==
A Practical Guide to Building OWL Ontologies using Protege4 and CO-ODE Tools - Version 1.3 (7.4 Annotation Properties - Annotation Properties)
随机推荐
BlockingQueue理论普
ORA-00600 [16703], [1403], [20]问题分析及恢复
网络安全入门基础:IP地址
3.List interface and implementation class
pycharm在创建py文件时如何自动注释
goproxy.io 证书过期
JDBC中的增删改查操作
通过程序发送 Gmail 邮件
5.转换流
LPP代码及其注释
5.Set接口与实现类
LeetCode75:颜色分类-C语言一次遍历求解
Super detailed MySQL basic operations
map去重代码实现
A Practical Guide to Building OWL Ontologies using Protege4 and CO-ODE Tools - Version 1.3 (7.4 Annotation Properties - Annotation Properties)
有返回值的函数
unittest测试框架原理及测试流程解析,看完绝对有提升
5.Set interface and implementation class
Go-控制语句那些事
3.List接口与实现类