Harbor: 如何获取镜像列表

Created on 11 Oct 2017  ·  5Comments  ·  Source: goharbor/harbor

你好,
用原生版本获取
curl -X GET --cacert /etc/docker/certs.d/xxx.com/ca.crt https://xxx.com/v2/_catalog
{"errors":[{"code":"UNAUTHORIZED","message":"authentication required","detail":[{"Type":"registry","Class":"","Name":"catalog","Action":"*"}]}]}
如果用swagger UI 获取
麻烦给一下请求uri
至此 敬礼。

areAPI kinquestion

Most helpful comment

Thanks all. the problem has been solved.
e.g.
curl -k -i -u admin:xxx https://xxx/service/token?account=admin\&service=harbor-registry\&scope=registry:catalog:*
curl -k -H "authorization: bearer $token " https://xxx/v2/_catalog
or use Harbor API
GET /api/projects
GET /api/repositories?project_id=
GET /api/repositories/tags?repo_name=XXX

Thank again.

All 5 comments

docker Version: 17.09.0-ce
docker-compose version 1.16.1, build 6d1ac219
harbor 1.2.0

还是需要自己动手看看

You can use Harbor's API to get repository list.
If you want to use the APIs of the registry directly, you need to get a valid token from Harbor's token service GET /service/token and then call registry's APIs with the token.

Thanks all. the problem has been solved.
e.g.
curl -k -i -u admin:xxx https://xxx/service/token?account=admin\&service=harbor-registry\&scope=registry:catalog:*
curl -k -H "authorization: bearer $token " https://xxx/v2/_catalog
or use Harbor API
GET /api/projects
GET /api/repositories?project_id=
GET /api/repositories/tags?repo_name=XXX

Thank again.

Good job, thanks a lot, I know how to use swagger-ui through this issue.

Was this page helpful?
0 / 5 - 0 ratings