如何从docker中的私有1.0注册表中搜索图像?

edw*_*ean 73 docker docker-registry

我做了一个私人注册表,curl xx.xx.xx.xx:5000没关系.我通过执行以下操作将图像推入docker私有注册表: docker push xx.xx.xx.xx:5000/centos
它返回:
http://xx.xx.xx.xx:5000/v1/repositories/centos/tags/latest

问题是如何从注册表Web或命令获取所有图像.我无法从docker注册表api中找到任何信息.任何人都有帮助?:)

iTe*_*ech 84

现在,从docker客户端,您只需直接搜索您的私人注册表,而无需使用HTTP API或任何额外的工具:

例如,搜索centos图像:

docker search localhost:5000/centos

  • 这应该在cli帮助页面上明确提到!https://docs.docker.com/reference/commandline/cli/#search (3认同)
  • 我不认为这适用于v2 (2认同)

小智 70

从私有注册表的 0.7.0版开始,您可以执行以下操作:

$ curl -X GET http://localhost:5000/v1/search?q=postgresql
Run Code Online (Sandbox Code Playgroud)

你会得到一个json有效载荷:

{"num_results": 1, "query": "postgresql", "results": [{"description": "", "name": "library/postgresql"}]}
Run Code Online (Sandbox Code Playgroud)

在这里给出更多背景是我如何开始我的注册表:

docker run \
        -e SETTINGS_FLAVOR=local \
        -e STORAGE_PATH=/registry \
        -e SEARCH_BACKEND=sqlalchemy \
        -e LOGLEVEL=DEBUG \
        -p 5000:5000 \
        registry
Run Code Online (Sandbox Code Playgroud)

  • 从api v2开始,它使用`http:// localhost:5000/v2/_catalog` https://docs.docker.com/registry/spec/api/完成 (10认同)
  • 请参阅此问题的参考https://github.com/docker/docker-registry/issues/63`curl -X GET http:// localhost:5000/v1/search`可以列出所有图像 (5认同)

snt*_*nth 66

所以我知道这是一个快速变化的领域但是(截至2015-09-08)我在Docker Registry HTTP API V2中发现了以下内容:

列出存储库(链接)

GET /v2/_catalog
Run Code Online (Sandbox Code Playgroud)

列出图像标签(链接)

GET /v2/<name>/tags/list
Run Code Online (Sandbox Code Playgroud)

基于以下内容,我在本地注册表上工作(注册表:2图像ID 1e847b14150e365a95d76a9cc6b71cd67ca89905e3a0400fa44381ecf00890e1创建于2015-08-25T07:55:17.072):

$ curl -X GET http://localhost:5000/v2/_catalog
{"repositories":["ubuntu"]}
$ curl -X GET http://localhost:5000/v2/ubuntu/tags/list
{"name":"ubuntu","tags":["latest"]}
Run Code Online (Sandbox Code Playgroud)


mre*_*mre 16

目前,Docker Registry v2没有搜索支持.

这个主题有一个长期运行的主题.目前的计划是支持最终扩展的搜索,这应该在v2.1之前完成.

作为一种变通方法,执行您的注册表V2正在运行的机器上执行以下操作:

> docker exec -it <your_registry_container_id> bash
> ls /var/lib/registry/docker/registry/v2/repositories/
Run Code Online (Sandbox Code Playgroud)

图像位于与其命名空间相对应的子目录中,例如 jwilder/nginx-proxy


小智 12

能够通过搜索"库"来获取我的私人注册表中的所有内容:

docker search [my.registry.host]:[port]/library
Run Code Online (Sandbox Code Playgroud)

退货(例如):

NAME                    DESCRIPTION   STARS     OFFICIAL   AUTOMATED
library/custom-image                  0                    
library/another-image                 0                    
library/hello-world                   0
Run Code Online (Sandbox Code Playgroud)

  • 在Ubuntu 14.04上使用docker 1.8.1我得到了`来自守护进程的错误响应:意外的状态代码404`,出了什么问题? (30认同)
  • 我有同样的问题命令'docker search repositroy_ip:5000/busybox'返回404,但上一个命令'docker push repository_ip:5000/busybox'已成功 (4认同)
  • 您可能需要使用curl来处理不安全的注册表,例如`curl --insecure -u "test:password" https://myregistrydomain.com:5000/v2/_catalog` (2认同)

小智 6

我安装了atc-/docker-registry-web项目,它给了我UI并搜索我的私有注册表. https://github.com/atc-/docker-registry-web

它是dockerised,你可以运行它

docker run -p 8080:8080 -e REG1=http://registry_host.name:5000/v1/ atcol/docker-registry-ui

并通过浏览查看内容 registry_ui_host.name:8080


smi*_*hra 5

列出所有图片

docker search <registry_host>:<registry_port>/
Run Code Online (Sandbox Code Playgroud)

列出类似“ vcs”的图像

docker search <registry_host>:<registry_port>/vcs
Run Code Online (Sandbox Code Playgroud)