jlk*_*sel 6 docker docker-registry
我正在尝试获取Docker hub的目录列表,但到目前为止我只是收到错误的响应.我的理解是我需要传递一个带有目录请求的持有者令牌,所以我首先获得具有相关范围的令牌:
curl -u "username:password "https://auth.docker.io/token?service=registry.docker.io&scope=registry:catalog:*"
Run Code Online (Sandbox Code Playgroud)
(这是使用我的Docker Hub帐户中的用户名/密码)
然后我将返回的令牌传递给注册表:
curl -vL -H "Authorization: Bearer eyJhbGciOiJFUzI1NiIsInR5cCI6I(...)" https://registry-1.docker.io/v2/_catalog
Run Code Online (Sandbox Code Playgroud)
为了回应这个要求,我得到了:
* Trying 54.86.130.73...
* Connected to registry-1.docker.io (54.86.130.73) port 443 (#0)
* TLS 1.2 connection using TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256
* Server certificate: *.docker.io
* Server certificate: RapidSSL SHA256 CA - G3
* Server certificate: GeoTrust Global CA
> GET /v2/_catalog HTTP/1.1
> Host: registry-1.docker.io
> User-Agent: curl/7.43.0
> Accept: */*
> Authorization: Bearer eyJhbGciOiJFUzI1NiIsInR5cCI6I(...)
>
< HTTP/1.1 401 Unauthorized
HTTP/1.1 401 Unauthorized
< Content-Type: application/json; charset=utf-8
Content-Type: application/json; charset=utf-8
< Docker-Distribution-Api-Version: registry/2.0
Docker-Distribution-Api-Version: registry/2.0
< Www-Authenticate: Bearer realm="https://auth.docker.io/token",service="registry.docker.io",scope="registry:catalog:*",error="insufficient_scope"
Www-Authenticate: Bearer realm="https://auth.docker.io/token",service="registry.docker.io",scope="registry:catalog:*",error="insufficient_scope"
< Date: Fri, 06 May 2016 23:00:08 GMT
Date: Fri, 06 May 2016 23:00:08 GMT
< Content-Length: 134
Content-Length: 134
< Strict-Transport-Security: max-age=31536000
Strict-Transport-Security: max-age=31536000
<
{"errors":[{"code":"UNAUTHORIZED","message":"authentication required","detail":[{"Type":"registry","Name":"catalog","Action":"*"}]}]}
Run Code Online (Sandbox Code Playgroud)
...似乎要求我回去并获得我在上面输入的URL的授权.
这有可能吗?如果是这样,我错过了什么?
小智 8
我遇到了同样的问题,通过docker支持提出了这个问题并获得了以下答案:"目录端点不能对Docker Hub起作用,因为该端点实际上列出了Registry上的所有存储库,我们禁用它,因为它会列出所有存储库Docker Hub."