gpt4 book ai didi

api - 为什么Docker “ancestry” API命令不起作用?

转载 作者:行者123 更新时间:2023-12-02 19:13:23 25 4
gpt4 key购买 nike

Docker Registry API文档(here)指出您可以执行以下操作:https://index.docker.io/v1/images/088b4505aa3adc3d35e79c031fa126b403200f02f51920fbd9b7c503e87c7a2c/ancestry
但是,这(我尝试过的具有多个图像ID)仅产生404。为什么?

最佳答案

您使用的域不正确。从文档示例中注意:

GET /v1/images/088b4505aa3adc3d35e79c031fa126b403200f02f51920fbd9b7c503e87c7a2c/ancestry HTTP/1.1
Host: registry-1.docker.io
Accept: application/json
Content-Type: application/json
Cookie: (Cookie provided by the Registry)

您应该使用Registry-1.docker.io,而不是index.docker.io。因此,您的网址应为:
https://registry-1.docker.io/v1/images/088b4505aa3adc3d35e79c031fa126b403200f02f51920fbd9b7c503e87c7a2c/ancestry

当我运行此程序时,我不再得到404,而是得到授权错误。这是因为您需要针对index.docker.io进行身份验证,然后针对Registry-1.docker.io运行您的api。

它的文档记录不充分-您可能会发现此讨论有帮助:

https://forums.docker.com/t/registry-hub-api-is-buggy/732

从讨论中:

registry-1.docker.io is the docker-registry used for storing images, this API is public, but requires authorization.

index.docker.io is the "index" now called RegistryHub, this tags endpoint is not public, and might change at any time. I would not use this one, since it is for internal use only, and may change without warning.

关于api - 为什么Docker “ancestry” API命令不起作用?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/28373899/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com