为什么 Docker "ancestry" API 命令不起作用?
Why does Docker "ancestry" API command not work?
Docker 注册表 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)
您应该使用注册表-1.docker.io,而不是 index.docker.io。所以你的 url 应该是:
https://registry-1.docker.io/v1/images/088b4505aa3adc3d35e79c031fa126b403200f02f51920fbd9b7c503e87c7a2c/ancestry
当我 运行 这时,我不再收到 404,而是收到授权错误。这是因为您需要针对 index.docker.io 进行身份验证,然后 运行 您的 api 针对 registry-1.docker.io。
它没有很好的记录 - 你可能会发现这个讨论有帮助:
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.
Docker 注册表 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)
您应该使用注册表-1.docker.io,而不是 index.docker.io。所以你的 url 应该是:
https://registry-1.docker.io/v1/images/088b4505aa3adc3d35e79c031fa126b403200f02f51920fbd9b7c503e87c7a2c/ancestry
当我 运行 这时,我不再收到 404,而是收到授权错误。这是因为您需要针对 index.docker.io 进行身份验证,然后 运行 您的 api 针对 registry-1.docker.io。
它没有很好的记录 - 你可能会发现这个讨论有帮助:
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.