调用docker registry api交互过程中http code码详解

本文详细解析了在与Docker Registry API交互时可能遇到的各种HTTP状态码,包括GET和DELETE请求的不同响应,以及BLOB_UNKNOWN、MANIFEST_INVALID等错误码的含义和原因。了解这些状态码和错误码有助于更好地理解和解决Docker Registry操作中出现的问题。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

注:参考官方文档:https://docs.docker.com/registry/spec/api/

1 与api交互http code

1.1 http code list

编码说明
200All right ok
202the image exists and has been successfully deleted
400The name or reference was invalid.
401The client is not authenticated.
403The client does not have required access to the repository / The registry does not implement the V2 API.
404The repository is not known to the registry.

1.2 GET /v2/

Code:200 ok
说明:On Success: OK
Code:404 not found
说明:The registry does not implement the V2 API.
Code:401 Unauthorized
说明:The client is not authenticated.

1.3 GET /v2/_catalog

Code:200 ok 说明:On Success: OK

1.4 GET /v2//tags/list

Code:200 OK
说明:On Success: OK
Code:401 Unauthorized
说明:The client is not authenticated.
Code:404 Not Found
说明:The repository is not known to the registry
Code:403 Forbidden
说明:The client does not have required access to the repository.

1.5 GET /v2//manifests/

Code:200 ok
说明:On Success: OK
Code:400 Bad Request
说明:The name or reference was invalid.
Code:401 Unauthorized
说明:The client is not authenticated.
Code:404 Not Found
说明:The repository is not known to the registry.
Code:403 Forbidden
说明:The client does not have required access to the repository.

1.6 DELETE /v2//manifests/

Code: 202 Accepted
说明:the image exists and has been successfully deleted
Code:404 Not Found
说明:the image had already been deleted or did not exist

2 通过调用api遇到错误码

2.1 BLOB_UNKNOWN

基本信息:
blob unknown to registry
详细描述:
This error may be returned when a blob is unknown to the registry in a specified repository. This can be returned with a standard get or if a manifest references an unknown layer during upload.

2.2 BLOB_UPLOAD_INVALID

基本信息:
blob upload invalid
详细描述:
The blob upload encountered an error and can no longer proceed.

2.3 BLOB_UPLOAD_UNKNOWN

基本信息:
blob upload unknown to registry
详细描述:
If a blob upload has been cancelled or was never started, this error code may be returned.

2.4 DIGEST_INVALID

基本信息:
provided digest did not match uploaded content
详细描述:
When a blob is uploaded, the registry will check that the content matches the digest provided by the client. The error may include a detail structure with the key “digest”, including the invalid digest string. This error may also be returned when a manifest includes an invalid layer digest.

2.5 MANIFEST_BLOB_UNKNOWN

基本信息:
blob unknown to registry
详细描述:
This error may be returned when a manifest blob is unknown to the registry.

2.6 MANIFEST_INVALID

基本信息:
manifest invalid
详细描述:
During upload, manifests undergo several checks ensuring validity. If those checks fail, this error may be returned, unless a more specific error is included. The detail will contain information the failed validation.

2.7 MANIFEST_UNKNOWN

基本信息:
manifest unknown
详细描述:
This error is returned when the manifest, identified by name and tag is unknown to the repository.

2.8 MANIFEST_UNVERIFIED

基本信息:
manifest failed signature verification
详细描述:
During manifest upload, if the manifest fails signature verification, this error will be returned.

2.9 NAME_INVALID

基本信息:
invalid repository name
详细描述:
Invalid repository name encountered either during manifest validation or any API operation.

2.10 NAME_UNKNOWN

基本信息:
repository name not known to registry
详细描述:
This is returned if the name used during an operation is unknown to the registry.

2.11 SIZE_INVALID

基本信息:
provided length did not match content length
详细描述:
When a layer is uploaded, the provided size will be checked against the uploaded content. If they do not match, this error will be returned.

2.12 TAG_INVALID

基本信息:
manifest tag did not match URI
详细描述:
During a manifest upload, if the tag in the manifest does not match the uri tag, this error will be returned.

2.13 UNAUTHORIZED

基本信息:
authentication required
详细描述:
The access controller was unable to authenticate the client. Often this will be accompanied by a Www-Authenticate HTTP response header indicating how to authenticate.

2.14 DENIED

基本信息:
requested access to the resource is denied
详细描述:
The access controller denied access for the operation on a resource.

2.15 UNSUPPORTED

基本信息:
The operation is unsupported.
详细描述:
The operation was unsupported due to a missing implementation or invalid set of parameters.


小笨驴在吃草的时候创建了微信公众号,为方便更多觅食的“小笨驴”,为大家准备了大量的免费基础教学资料以及技术解决方案,还会定时发布一些好的技术文章,当然也会扯扯蛋、谈谈人生、呵呵,希望我们这群乐于分享技术的“小笨驴”团队越来越大!


这里写图片描述

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值