API redhat 基础镜像获取镜像标签的值?

API for redhat base image to get values of image tags?

我们是否有 API 以编程方式获取下图的图像标签值?

https://access.redhat.com/containers/?tab=tags&get-method=registry-tokens#/registry.access.redhat.com/rhel7

用例: 如果有新的标签版本可用,请获取更高版本。

我正在寻找如下内容:

wget -q https://registry.hub.docker.com/v1/repositories/debian/tags -O -  | sed -e 's/[][]//g' -e 's/"//g' -e 's/ //g' | tr '}' '\n'  | awk -F: '{print }'

以上解决方案来自Whosebug问题:


我做到了

wget https://access.redhat.com/containers/?tab=tags&get-method=registry-tokens#/registry.access.redhat.com/rhel7

不幸的是,它给出了很多无用的冗余数据。

感谢任何线索。

谢谢

一种选择是使用skopeo 命令获取有关远程图像的信息。例如,如果您 运行:

skopeo inspect docker://registry.access.redhat.com/rhel7

您将取回一大块 JSON 数据,其中包含有关所有可用标签的信息:

{
    "Name": "registry.access.redhat.com/rhel7",
    "Digest": "sha256:11ec91dcb3505f6eaa02d815fab39078786f3ddbef26796e3ef348410ca43b9d",
    "RepoTags": [
        "7.3-74",
        "7.4-120",
        "7.2-56",
        "7.3-89",
        "7.3-66",
        "7.5-424",
        "7.5-245.1527091554",
        "7.4-129",
        "7.1-12",
        "7.6-122",
        "7.3-82",
        "7.7-384.1575996163",
        "7.5-409.1533127727",
        "7.2-75",
        "7.2-38",
        "7.6",
[...]

(一共70个左右)

由于 skopeo returns JSON 结果,很容易获取此输出并以编程方式解析它以提取所需信息。


使用 skopeo (skopeo --debug ...) 的调试输出,我发现标签列表也可从 https://registry.access.redhat.com/v2/rhel7/tags/list 获得。这似乎无需身份验证即可工作,所以这可能是最简单的选择。