附录:OCI 制品库支持的 manifest 类型
685 字约 2 分钟
Docker、Helm、Docker Model 三类制品库基于 OCI manifest 协议识别制品类型,并按 制品类型准入限制决定是否接受推送。识别规则:
- config mediaType 决定制品类型归属(如
vnd.oci.image.config.v1+json归为容器镜像); - 部分类型还需进一步检查 manifest layers(如空 config 的制品需全部 layers 均为带
in-toto.io/predicate-typeannotation 的application/vnd.in-toto+json层才判为 Attestation,否则为 UNKNOWN)。
适用范围
本附录仅适用于 Docker、Helm、Docker Model 三类 OCI 制品库。 Maven、npm、PyPI 等其他制品库使用各自的原生协议,不涉及 manifest 类型识别。
Docker 制品库
| 制品类型 | config mediaType | 额外识别条件 | 典型场景 |
|---|---|---|---|
| 容器镜像(IMAGE) | application/vnd.oci.image.config.v1+json | — | docker push / docker buildx build --push 推送的镜像 |
| 容器镜像(IMAGE) | application/vnd.docker.container.image.v1+json | — | Docker schema2 格式镜像 |
| buildx 注册表缓存(BUILD_CACHE) | application/vnd.buildkit.cacheconfig.v0 | — | docker buildx build --cache-to type=registry 推送的构建缓存 |
| Attestation(ATTESTATION) | application/vnd.oci.empty.v1+json | config 须为标准 empty descriptor(digest 固定、size 为 2),且 manifest 全部 layers 均为带非空 in-toto.io/predicate-type annotation 的 application/vnd.in-toto+json 层 | buildx 构建产生的 provenance/SBOM 证明 |
多架构镜像的 index(application/vnd.oci.image.index.v1+json 或 application/vnd.docker.distribution.manifest.list.v2+json)会随其子 manifest 一并接受,无需单独配置。
注意
- Attestation 识别需同时满足:config 为
application/vnd.oci.empty.v1+json标准 empty descriptor(digest 为sha256:44136fa355b3678a1146ad16f7e8649e94fb4fc21fe77e8310c060f61caaff8a、size 为 2),且 manifest 的全部 layers 均为携带非空in-toto.io/predicate-typeannotation 的application/vnd.in-toto+json层(即真正的 buildkit provenance/SBOM),layer 数量不超过 16。不满足条件的制品(如oras push默认空 config 通用制品、伪造 in-toto mediaType 但无 predicate-type 的制品、或混入非 in-toto 层的制品)会被判为 UNKNOWN,推送到 Docker 制品库会被拒绝。 - 带自定义 config mediaType 的通用 OCI 制品(如
application/vnd.myapp.config.v1+json)当前不支持推送到 Docker 制品库,会被拒绝。 - Attestation 识别为启发式判定,不构成供应链安全边界:manifest 字段由推送方控制,理论上可伪造 in-toto 层绕过类型检查。制品库仅负责类型路由与存储,不校验 attestation 内容的真实性或签名。
Helm 制品库
| 制品类型 | config mediaType | 典型场景 |
|---|---|---|
| Helm Chart(CHART) | application/vnd.cncf.helm.config.v1+json | helm push(OCI 格式) |
Docker Model 制品库
| 制品类型 | config mediaType | 典型场景 |
|---|---|---|
| Docker Model(DockerModel) | application/vnd.docker.ai.model.config.v0.1+json | docker model push |
推送被拒绝时的报错
推送未在白名单中的类型时,会返回如下错误,已上传的 blob 由垃圾回收(GC)自动清理:
denied: artifact type "CHART" is not allowed to be pushed to a "docker" registry