首页 > 解决方案 > Docker 私有注册表 /v2/_catalog 不提取 repos 但 /v2/repo/tags/ 有效?

问题描述

我正在尝试在我的私人注册表中列出存储库,但由于未知原因,轮询/v2/_catalog不会返回任何结果,但指定存储库确实会返回结果。

我也可以毫无问题地推拉到这个仓库,所以我很困惑。

// Doesn't work =>
curl -kv -X GET https://registry.example.com/v2/_catalog  --user user:pass

// Does Work =>
curl -kv -X GET https://registry.example.com/v2/nginx/tags/list  --user user:pass

失败的 curl 请求的输出是:

*   Trying 000.000.000.000...
* TCP_NODELAY set
* Connected to registry.example.com (000.000.000.000 port 443 (#0)
* ALPN, offering h2
* ALPN, offering http/1.1
* Cipher selection: ALL:!EXPORT:!EXPORT40:!EXPORT56:!aNULL:!LOW:!RC4:@STRENGTH
* successfully set certificate verify locations:
*   CAfile: /etc/ssl/cert.pem
  CApath: none
* TLSv1.2 (OUT), TLS handshake, Client hello (1):
* TLSv1.2 (IN), TLS handshake, Server hello (2):
* TLSv1.2 (IN), TLS handshake, Certificate (11):
* TLSv1.2 (IN), TLS handshake, Server key exchange (12):
* TLSv1.2 (IN), TLS handshake, Server finished (14):
* TLSv1.2 (OUT), TLS handshake, Client key exchange (16):
* TLSv1.2 (OUT), TLS change cipher, Client hello (1):
* TLSv1.2 (OUT), TLS handshake, Finished (20):
* TLSv1.2 (IN), TLS change cipher, Client hello (1):
* TLSv1.2 (IN), TLS handshake, Finished (20):
* SSL connection using TLSv1.2 / ECDHE-RSA-AES256-GCM-SHA384
* ALPN, server accepted to use h2
* Server certificate:
*  subject: O=Acme Co; CN=Kubernetes Ingress Controller Fake Certificate
*  start date: Feb 13 16:27:49 2019 GMT
*  expire date: Feb 13 16:27:49 2020 GMT
*  issuer: O=Acme Co; CN=Kubernetes Ingress Controller Fake Certificate
*  SSL certificate verify result: unable to get local issuer certificate (20), continuing anyway.
* Using HTTP2, server supports multi-use
* Connection state changed (HTTP/2 confirmed)
* Copying HTTP/2 data in stream buffer to connection buffer after upgrade: len=0
* Server auth using Basic with user 'user'
* Using Stream ID: 1 (easy handle 0x7f83b1800400)
> GET /v2/_catalog HTTP/2
> Host: registry.example.com
> Authorization: Basic asdfasdfasdfasdfasdfasdfa
> User-Agent: curl/7.54.0
> Accept: */*
> 
* Connection state changed (MAX_CONCURRENT_STREAMS updated)!
< HTTP/2 502 
< server: nginx/1.15.8
< date: Wed, 13 Feb 2019 17:27:17 GMT
< content-type: text/html
< content-length: 157
< strict-transport-security: max-age=15724800; includeSubDomains
< 
<html>
<head><title>502 Bad Gateway</title></head>
<body>
<center><h1>502 Bad Gateway</h1></center>
<hr><center>nginx/1.15.8</center>
</body>
</html>
* Connection #0 to host registry.example.com left intact

标签: nginxdocker-registry

解决方案


我也在寻找这个问题的答案,


   I am trying to get list of repository on jfrog Docker local repository through v2/_catalog. 
   let say repository name: devops and image:mongo:3.6
   jfrog registry url : http://192.168.19.99:8081

   GET API is : curl -k -u test:123test123 -X GET http://192.168.19.99:8081/v2/_catalog

   **Response returns empty** 

   However if put repository name after **v2/reponame/_catalog** then getting correct list of image 
  belongs to given repository.
  e.g: curl -k -u test:123test123 -X GET http://192.168.19.99:8081/v2/devops/_catalog

  {
    "repositories" : [ "mongo" ]
  }

  But i am looking to get through **v2/_catalog** 
  If there any way to make it work using **v2/_catalog**
  However i also tried with Nginx configuration but  **v2/_catalog** returns empty ONLY

  --
  Thanks ```

推荐阅读