harbor通过api删除指定的镜像

本文介绍了如何使用HarborAPI进行镜像的管理,包括删除特定版本的镜像、查看reference信息以及获取上传的第一个镜像的tag。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

1.Harbor api版本

2.删除镜像方法

3.查看reference方法
curl -u admin:Harbor12345 -X GET "https://xxxxx/api/v2.0/projects/项目名字/repositories/镜像名字/artifacts?page=1&page_size=1&with_tag=true&with_label=false&with_scan_overview=false&with_signature=false&with_immutable_status=false" | sed 's/,/\n/g' | grep digest | awk -F '"' '{print $4}'
4.执行删除命令
curl  -u "admin:Harbor12345" -X DELETE "https://xxxxx/api/v2.0/projects/项目名字/repositories/镜像名字/artifacts/sha256:4d8a95c65a0646f329c8749ef4ffd58839a60be042feeb3ba9200dce28a1b7d7"
5.获取上传的第一个镜像的tag
curl -L -u admin:Harbor12345 -sS  --max-time 30 --connect-timeout 60 --retry 300 --retry-delay 100  "xxxxx/api/v2.0/projects/项目名字/repositories/镜像名字/artifacts?page=1&page_size=1&with_tag=true&with_label=false&with_scan_overview=false&with_signature=false&with_immutable_status=false" -H  "Expect:" |  sed \'s/,/\\n/g\' |  grep "none" | awk -F \':\' \'{print $2}\' | sed \'s/"//g\'`

评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值