Harbor Api调用

Harbor API调用

1、获取镜像仓库名字

	curl -u "admin:Harbor12345" -X GET -H "Content-Type: application/json" "http://10.0.0.14/api/search?" --insecure

2、获取镜像标签

	curl -u "admin:Harbor12345" -X GET -H "Content-Type: application/json" "http://10.0.0.14/api/repositories/tags?repo_name=library%2Fmysql"

3、对镜像标签进行排序,并补充完整镜像名称

	curl -u "admin:Harbor12345" -X GET -H "Content-Type: application/json" "http://10.0.0.14/api/repositories/tags?repo_name=library%front-end"|sort -n -t _ -k 2 |sed 's#"##g'|sed 's#,##g'|sed 's# ##g'|awk  '{print  "library/sephora-mp-backend:"$1}'
	

4、删除镜像标签

	curl -u "admin:Harbor12345" -X DELETE -H "Content-Type: application/json" "http://10.0.0.14/api/repositories?repo_name=library%2Fblackicebird-2048&tag=v2"
posted @ 2022-04-15 20:33  彬彬l  阅读(912)  评论(0)    收藏  举报