如何在Docker命令行的Docker注册表中找到带有特定标签的Docker映像? [英] How can I find a Docker image with a specific tag in Docker registry on the Docker command line?
问题描述
我尝试为Docker映像找到一个特定的标签。如何在命令行上执行此操作?我要避免下载所有图像,然后删除不需要的图像。
I try to locate one specific tag for a Docker image. How can I do it on the command line? I want to avoid downloading all the images and then removing the unneeded ones.
在Ubuntu官方发行版中, https://registry.hub.docker.com/_/ubuntu/ ,有几个标签(已发布),而当我在命令中搜索它时
In the official Ubuntu release, https://registry.hub.docker.com/_/ubuntu/, there are several tags (release for it), while when I search it on the command line,
user@ubuntu:~$ docker search ubuntu | grep ^ubuntu
ubuntu Official Ubuntu base image 354
ubuntu-upstart Upstart is an event-based replacement for ... 7
ubuntufan/ping 0
ubuntu-debootstrap 0
也在命令行 search
> https://docs.docker.com/engine/reference/commandline/search/ ,不知道
在 docker search
命令中是否可能?
如果我使用原始命令通过 Docker注册表API 进行搜索,然后可以获取信息:
If I use a raw command to search via the Docker registry API, then the information can be fetched:
$ curl https://registry.hub.docker.com//v1/repositories/ubuntu/tags | python -mjson.tool
[
{
"layer": "ef83896b",
"name": "latest"
},
.....
{
"layer": "463ff6be",
"name": "raring"
},
{
"layer": "195eb90b",
"name": "saucy"
},
{
"layer": "ef83896b",
"name": "trusty"
}
]
推荐答案
As据我所知,CLI不允许在存储库中搜索/列出标签。
As far as I know, the CLI does not allow searching/listing tags in a repository.
但是,如果您知道要使用哪个标签,可以通过添加一个冒号和映像名称: docker pull ubuntu:saucy
But if you know which tag you want, you can pull that explicitly by adding a colon and the image name: docker pull ubuntu:saucy
这篇关于如何在Docker命令行的Docker注册表中找到带有特定标签的Docker映像?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!