我想获取有关 docker 映像的已发布版本/标签的一些基本信息,以了解我可以提取哪些 image:tag。我还想查看每个标签最近发布的时间。
有没有办法在命令行上执行此操作?
Docker version 1.10.2, build c3959b1
Run Code Online (Sandbox Code Playgroud)
基本上寻找相当于npm info {pkg}docker 镜像的东西。
不是从命令行。你有docker search,但它只返回你想要的数据的子集,并且仅针对带有:latest标签的图像:
> docker search sixeyed/hadoop-dotnet
NAME DESCRIPTION STARS OFFICIAL AUTOMATED
sixeyed/hadoop-dotnet Hadoop with .NET Core installed 1 [OK]
Run Code Online (Sandbox Code Playgroud)
如果您想要更多详细信息,您需要使用注册表 API,但它只有一个用于列出存储库的目录端点,搜索问题仍然悬而未决。
假设您知道存储库名称,您可以导航 API - 首先您需要一个身份验证令牌:
> curl "https://auth.docker.io/token?service=registry.docker.io&scope=repository:sixeyed/hadoop-dotnet:pull"
{"token":"eyJhbG...
Run Code Online (Sandbox Code Playgroud)
然后将令牌传递给后续请求,例如列出标签:
> curl --header "Authorization: Bearer eyJh..." https://index.docker.io/v2/sixeyed/hadoop-dotnet/tags/list
{"name":"sixeyed/hadoop-dotnet","tags":["2.7.2","latest"]}
Run Code Online (Sandbox Code Playgroud)
然后通过存储库名称和标签获取有关一张图像的所有信息:
> curl --header "Authorization: Bearer eyJh..." https://index.docker.io/v2/sixeyed/hadoop-dotnet/manifests/latest
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
13718 次 |
| 最近记录: |