harbor rest API

 

 

# 查看镜像

curl -u "admin:Harbor12345" -X GET -H "Content-Type: application/json" "http://172.168.1.249/api/repositories?project_id=2&q=镜像名"

curl -u "admin:Harbor12345" -X GET -H "Content-Type: application/json" "http://172.168.1.249/api/repositories/sw_repo%2Fmyapps/tags/latest"

#根据digest id 获取镜像名:

curl --silent http://172.168.1.249/api/repositories/sw_repo%2Fmyapps/tags?detail=1  -X GET -H 'Content-Type: application/json'  |grep "digestid" -C 2 |grep name |grep -v latest -m1 |cut -d\" -f 4

# 删除镜像

curl -u "admin:Harbor12345" -X DELETE -H "Content-Type: application/json" "http://172.168.1.249/api/repositories/marktrace%2Fasset/tags/latest"

# 获取镜像标签

curl -s -u "admin:Harbor12345" -X GET -H "Content-Type: application/json" "http://172.168.1.249/api/repositories/marktrace%2Fasset/tags/" |grep "digest" -C 2 |grep ""name""

 

https://www.yangxinghui.com/1378.html

 

https://editor.swagger.io/?url=https://raw.githubusercontent.com/goharbor/harbor/main/api/v2.0/swagger.yaml
https://editor.swagger.io/?url=https://raw.githubusercontent.com/goharbor/harbor/main/api/v2.0/legacy_swagger.yaml

code and API: http://github.com/vmware/harbor

 

posted @ 2022-06-02 22:36  i舒  阅读(159)  评论(0编辑  收藏  举报