如何获取 docker registry v2 上的图像列表 [英] How to get a list of images on docker registry v2
问题描述
我正在使用 docker registry v1,并且我有兴趣迁移到较新的版本 v2.但是我需要一些方法来获取注册表中存在的图像列表;例如使用注册表 v1,我可以对 http://myregistry:5000/v1/search?
执行 GET 请求,结果是:
I'm using docker registry v1 and I'm interested in migrating to the newer version, v2. But I need some way to get a list of images present on registry; for example with registry v1 I can execute a GET request to http://myregistry:5000/v1/search?
and the result is:
{
"num_results": 2,
"query": "",
"results": [
{
"description": "",
"name": "deis/router"
},
{
"description": "",
"name": "deis/database"
}
]
}
但我在官方文档上找不到类似的东西来获取列表注册表上的图像.有人知道在新版本 v2 上的方法吗?
But I can't find on official documentation something similar to get a list of image on registry. Anybody knows a way to do it on new version v2?
推荐答案
对于最新(截至 2015-07-31)版本的 Registry V2,您可以获取 此图像 来自 DockerHub:
For the latest (as of 2015-07-31) version of Registry V2, you can get this image from DockerHub:
docker pull distribution/registry:master
列出所有存储库(有效图像):
List all repositories (effectively images):
curl -X GET https://myregistry:5000/v2/_catalog
> {"repositories":["redis","ubuntu"]}
列出仓库的所有标签:
curl -X GET https://myregistry:5000/v2/ubuntu/tags/list
> {"name":"ubuntu","tags":["14.04"]}
如果注册表需要身份验证,您必须在curl
命令中指定用户名和密码
If the registry needs authentication you have to specify username and password in the curl
command
curl -X GET -u <user>:<pass> https://myregistry:5000/v2/_catalog
curl -X GET -u <user>:<pass> https://myregistry:5000/v2/ubuntu/tags/list
这篇关于如何获取 docker registry v2 上的图像列表的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!