实验脚本
docker run -d -p 6000:5000 --restart=always --name registry registry:3
(
docker pull debian:13.3
docker tag debian:13.3 127.0.0.1:6000/test/hello/foo/debian:13.3
docker push 127.0.0.1:6000/test/hello/foo/debian:13.3
docker rmi debian:13.3
docker rmi 127.0.0.1:6000/test/hello/foo/debian:13.3
docker pull 127.0.0.1:6000/test/hello/foo/debian:13.3
)
13.3: Pulling from library/debian
Digest: sha256:2c91e484d93f0830a7e05a2b9d92a7b102be7cab562198b984a84fdbc7806d91
Status: Downloaded newer image for debian:13.3
docker.io/library/debian:13.3
The push refers to repository [127.0.0.1:6000/test/hello/foo/debian]
d16566b6c5a6: Pushed
13.3: digest: sha256:523f9ef87fef9521745426990636ccc7ea42bf8e3ddb3ac9083b385d0c714a89 size: 528
Untagged: debian:13.3
Untagged: 127.0.0.1:6000/test/hello/foo/debian:13.3
Untagged: 127.0.0.1:6000/test/hello/foo/debian@sha256:523f9ef87fef9521745426990636ccc7ea42bf8e3ddb3ac9083b385d0c714a89
13.3: Pulling from test/hello/foo/debian
Digest: sha256:523f9ef87fef9521745426990636ccc7ea42bf8e3ddb3ac9083b385d0c714a89
Status: Downloaded newer image for 127.0.0.1:6000/test/hello/foo/debian:13.3
127.0.0.1:6000/test/hello/foo/debian:13.3
curl -fsSL http://127.0.0.1:6000/v2/_catalog | jq
{
"repositories": [
"test/hello/foo/debian"
]
}
curl -fsSL http://127.0.0.1:6000/v2/test/hello/foo/debian/tags/list | jq
{
"name": "test/hello/foo/debian",
"tags": [
"13.3"
]
}
GET /v2/[name]/tags/list?n=<integer>&last=<integer>
注意:
– registry=注册表
– repository=仓库
也就是说在这个本地6000端口的注册表中包含仓库的名字就是 test/hello/foo/debian 而不是debian
curl -fsSL http://127.0.0.1:6000/v2/ -I
HTTP/1.1 200 OK
Content-Length: 2
Content-Type: application/json
Docker-Distribution-Api-Version: registry/2.0
Date: Sat, 14 Feb 2026 06:06:22 GMT
| 方法 | 路径 | 实体 | 描述 |
|---|---|---|---|
| GET | /v2/ | Base | 检查端点是否实现了Docker Registry API V2。 |
| GET | /v2/[name]/tags/list | Tags | 获取指定名称的仓库下的标签。 |
| GET | /v2/[name]/manifests/[reference] | Manifest | 获取指定名称和引用的清单。 |
| PUT | /v2/[name]/manifests/[reference] | Manifest | 更新指定名称和引用的清单。 |
| DELETE | /v2/[name]/manifests/[reference] | Manifest | 删除指定名称和引用的清单或标签。 |
| GET | /v2/[name]/blobs/[digest] | Blob | 获取指定摘要的Blob。 |
| DELETE | /v2/[name]/blobs/[digest] | Blob | 删除指定摘要的Blob。 |
| POST | /v2/[name]/blobs/uploads/ | Initiate Blob Upload | 初始化可恢复的Blob上传。 |
| GET | /v2/[name]/blobs/uploads/[uuid] | Blob Upload | 获取指定UUID的上传状态。 |
| PATCH | /v2/[name]/blobs/uploads/[uuid] | Blob Upload | 上传指定上传的块数据。 |
| PUT | /v2/[name]/blobs/uploads/[uuid] | Blob Upload | 完成指定UUID的上传。 |
| DELETE | /v2/[name]/blobs/uploads/[uuid] | Blob Upload | 取消指定UUID的上传。 |
| GET | /v2/_catalog | Catalog | 获取注册表中可用的仓库列表。 |
regctl registry set --tls disabled 127.0.0.1:6000
regctl manifest head 127.0.0.1:6000/test/hello/foo/debian:13.3
sha256:523f9ef87fef9521745426990636ccc7ea42bf8e3ddb3ac9083b385d0c714a89
regctl manifest get 127.0.0.1:6000/test/hello/foo/debian:13.3
Name: 127.0.0.1:6000/test/hello/foo/debian:13.3
MediaType: application/vnd.docker.distribution.manifest.v2+json
Digest: sha256:523f9ef87fef9521745426990636ccc7ea42bf8e3ddb3ac9083b385d0c714a89
Total Size: 50.475MB
Config:
Digest: sha256:404d07a1110c5965e2a8c39c66a2985de4d977c8bf66033309c13007322dcf3e
MediaType: application/vnd.docker.container.image.v1+json
Size: 451B
Layers:
Digest: sha256:f2520f145cbbf7dc787dd7a5d1cf7c93b03a027ab39b9465f25718cdeed75deb
MediaType: application/vnd.docker.image.rootfs.diff.tar.gzip
Size: 50.475MB
