01-docker registry http api v2
docker registry http api v2
Table of Contents
- Table of Contents
- 1: Overview
- 2: 专有名词解释
- 3: Push image 过程
- 4: Pull image 过程
- 5: Retrieve 检索功能
- 6: Deleteing an Image(删除镜像)
- 7: Errors 错误信息
1: Overview
| methods | path | Entity | Description |
|---|---|---|---|
| GET | /v2/ | Base | 检查 the endpoint 是否实现了 Docker Registry API V2. |
| GET | /v2/{name}/tags/list | Tags | 通过 name 获取 repository 下的 tags |
| GET | /v2/{name}/manifests/{reference} | Manifest | 获取由 name 和 references 标识的 manifest,其中 referencec 可以是 tag 或 digest。还可以向该 endpoint 发出 HEAD 请求以获取资源信息,而不接收所有数据。 |
| PUT | /v2/{name}/manifests/{reference} | Manifest | Put 由 name 和 reference 标识的 manifest |
| DELETE | /v2/{name}/manifests/{reference} | Manifest | 删除由 digest 标识的 manifest |
| GET | /v2/{name}/blobs/{digest} | Blob | 从 registry retrieve 由 digest 标识的 blobs |
| DELETE | /v2/{name}/blobs/{digest} | Blob | Delete the blob identified by name and digest |
| POST | /v2/{name}/blobs/uploads/ | Initiate(启动) Blob upload 服务 | 启动可恢复的 blob upload 服务。如果成功,将提供上载位置以完成上载。或者,如果存在 digest 参数,则请求正文将用于在单个请求中完成上载。 |
| GET | /v2/{name}/blobs/uploads/{uuid} | Blob Upload | 检索由 uuid 标识的上传状态。此 endpoint 的主要目的是 resolve 可恢复 upload 的当前状态。 |
| PATCH | /v2/{name}/blobs/uploads/{uuid} | Blob Upload | 上传 指定 upload 的 chunk 数据块 |
| PUT | /v2/{name}/blobs/uploads/{uuid} | Blob Upload | 完成 uuid 指定的上传,可以选择附加 body 作为最后一个块 |
| DELETE | /v2/{name}/blobs/uploads/{uuid} | Blob Upload | Cancel outstanding upload processes, releasing associated resources. If this is not called, the unfinished uploads will eventually timeout. |
| GET | /v2/_catalog | Catalog | 在 registry 中检索一个有序的,可用的 repositry 的 json 列表 |
2: 专有名词解释
- repositry name(存储库名称):存储库指在库中存储的镜像
- digest(摘要):是 image 各个层的唯一标识。虽然算法允许使用任意算法,但是为了兼容性应该使用 sha256。
例:
sha256:6c3c624b58dbbcd3c0dd82b4c53f04194d1247c6eebdaab7c610cf7d66709b3b
3: Push image 过程
先推各个 Layer 层到 registry 仓库,然后上传清单 Manifest