注:
Harbor镜像仓库地址:172.168.1.249
文章源自小柒网-https://www.yangxingzhen.cn/7484.html
# 获取项目信息
文章源自小柒网-https://www.yangxingzhen.cn/7484.html
curl -u "admin:Harbor12345" -X GET -H "Content-Type: application/json" "http://172.168.1.249/api/projects/2"
文章源自小柒网-https://www.yangxingzhen.cn/7484.html
# 获取所有项目信息
文章源自小柒网-https://www.yangxingzhen.cn/7484.html
curl -u "admin:Harbor12345" -X GET -H "Content-Type: application/json" "http://172.168.1.249/api/projects?"
文章源自小柒网-https://www.yangxingzhen.cn/7484.html
# 搜索镜像
文章源自小柒网-https://www.yangxingzhen.cn/7484.html
curl -u "admin:Harbor12345" -X GET -H "Content-Type: application/json" "http://172.168.1.249/api/search?q=asset"
文章源自小柒网-https://www.yangxingzhen.cn/7484.html
# 删除项目
文章源自小柒网-https://www.yangxingzhen.cn/7484.html
curl -u "admin:Harbor12345" -X DELETE -H "Content-Type: application/json" "http://172.168.1.249/api/projects/3"
文章源自小柒网-https://www.yangxingzhen.cn/7484.html
# 创建项目
文章源自小柒网-https://www.yangxingzhen.cn/7484.html
curl -u "admin:Harbor12345" -X POST -H "Content-Type: application/json" "http://172.168.1.249/api/projects" -d @createproject.json
createproject.json为文件名,文件内容参考createproject.json
# 0为私有
{
"project_name": "项目名",
"public": 0
}
# 创建用户
curl -u "admin:Harbor12345" -X POST -H "Content-Type: application/json" "http://172.168.1.249/api/users" -d @user.json
文件内容参考user.json
{
"user_id": 5,
"username": "test",
"email": "test@qq.com",
"password": "Harbor12345",
"realname": "test",
"role_id": 0
}
# 获取用户信息,除admin外
curl -u "admin:Harbor12345" -X GET -H "Content-Type: application/json" "http://172.168.1.249/api/users"
# 查看当前用户信息
curl -u "admin:Harbor12345" -X GET -H "Content-Type: application/json" "http://172.168.1.249/api/users/current"
# 删除用户,3是用户user_id
curl -u "admin:Harbor12345" -X DELETE -H "Content-Type: application/json" "http://172.168.1.249/api/users/34"
# 修改用户密码
curl -u "admin:Harbor12345" -X PUT -H "Content-Type: application/json" "http://172.168.1.249/api/users/4/password" -d @uppwd.json
# 查看项目相关角色
curl -u "admin:Harbor12345" -X GET -H "Content-Type: application/json" "http://172.168.1.249/api/projects/2/members/"
# 项目添加角色
curl -u "jaymarco:Harbor123456" -X POST -H "Content-Type: application/json" "http://172.168.1.249/api/projects/2/members/" -d @role.json
# 查看镜像
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 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""
若文章图片、下载链接等信息出错,请在评论区留言反馈,博主将第一时间更新!如本文“对您有用”,欢迎随意打赏,谢谢!
评论