2

有没有人用 Docker 1.6 和新的注册表 2.0 成功地尝试过搜索命令?

我已经使用 SSL 在 Nginx 后面设置了我的,到目前为止它工作正常。我可以pushpull图像没有问题。但是当我尝试搜索它们时,以下所有命令都会给出404响应:

curl -k -s -X GET https://username:password@my-docker-registry.com/v1/search
404 page not found

curl -k -s -X GET https://username:password@my-docker-registry.com/v2/search
404 page not found

root@ip-10-232-0-191:~# docker search username:password@my-docker-registry.com/hello-world
FATA[0000] Invalid repository name (admin:admin), only [a-z0-9-_.] are allowed

root@ip-10-232-0-191:~# docker search my-docker-registry.com/hello-world
FATA[0000] Error response from daemon: Unexpected status code 404

我想问是否有人知道为什么以及使用 Docker 客户端在注册表中搜索图像的正确方法是什么。

查看API v2.0 文档,他们根本不支持搜索功能吗?省略这样的功能似乎有点奇怪。

至少有些东西有效:)

root@ip-10-232-0-191:~# curl -k -s -X GET https://username:password@my-docker-registry.com/v2/hello-world/tags/list
{"name":"hello-world","tags":["latest"]}
4

3 回答 3

2

迄今为止 - 注册表 v2.0.1 中缺少搜索 api,此问题正在讨论。我相信搜索 api 旨在登陆 v2.1。

编辑:/v2/catalog endpoint可在distribution/registry:master

在新的注册表 api 之前:

如果您正在使用REGISTRY_STORAGE_FILESYSTEM_ROOTDIRECTORY,您可以列出该目录的内容

user@host:~#  tree $REGISTRY_FS_ROOTDIR/docker/registry/v2/repositories -L 2
***/docker/registry/v2/repositories
└── repository1
    └── image1

这对于制作一个快速的 web ui 可能很有用,您可以调用它来执行此操作,或者如果您对存储存储库的主机具有 ssh 访问权限:

ssh -T user@host -p <port> tree $REGISTRY_FS_ROOTDIR/docker/registry/ -L 2

请查看在nginx 反向代理后面部署 v1 和 v2 注册表的compose 示例

于 2015-06-21T01:05:55.703 回答
1

如果你在 Windows 上,这里有一个 Powershell 脚本,可以v2/_catalog使用基本的 http auth 从 Windows 查询。

https://gist.github.com/so0k/b59382ea7fd959cf7040

仅供参考,要使用它,您必须docker pull distribution/registry:master代替docker pull registry:2. registry:2图像版本当前不2.0.1附带目录端点。

于 2015-07-29T09:10:34.307 回答
1

https://github.com/docker/distribution提供的最新版本的 Docker Registry支持 Catalog API。(v2/_catalog)。这允许搜索存储库的能力。

如果有兴趣,您可以尝试我构建的 docker image registry CLI,以便轻松使用新 Docker Registry v2 发行版中的搜索功能:( https://github.com/vivekjuneja/docker_registry_cli )

于 2015-07-28T11:32:08.743 回答