当前位置:网站首页>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进阶实战》.
边栏推荐
猜你喜欢
Arrays类、冒泡排序、选择排序、插入排序、稀疏数组!
在anaconda环境中配置cuda和cudnn
快速解决MySQL插入中文数据时报错或乱码问题
2021-04-26QGIS3.10加载天地图影像(地图瓦片)的一种方法
What does the test plan include?What is the purpose and meaning?
web测试之功能测试常用的方法有哪几种?有什么要点要注意?
【机器学习】数据科学基础——机器学习基础实践(二)
Ontology Development Diary 03 - When debugging is in progress
nacos从下载到安装集群的
Another implementation of lateral view explode
随机推荐
What does the test plan include?What is the purpose and meaning?
LeetCode179:最大数(C语言)代码简洁!
有返回值的函数
2.Collection接口
喜迎排名18
8.递归遍历和删除案例
.ts 音频文件转换成 .mp3 文件
类 对象 属性 方法 类的成员
1. Introduction to threads
4. Character stream
GBase数据库产生迁移工具假死的原因是什么?
nacos从下载到安装集群的
LeetCode147:对链表进行插入排序 画图分析 思路清晰!
图表示学习(Graph Representation Learning)笔记
4.字符流
.equals==
2.字节流
6.File类
unittest测试框架原理及测试流程解析,看完绝对有提升
快速解决MySQL插入中文数据时报错或乱码问题