系统学习 DevOps 学习路径:从版本控制到可观测与供应链

oras

ORAS OCI 制品管理

补充说明

ORAS 用 OCI Registry 存储任意制品(Helm chart、SBOM、签名、模型、二进制),不局限于容器镜像。它把制品作为 OCI artifact 推送,复用镜像仓库的认证、复制和保留策略。

常用命令:oras push、oras pull、oras discover、oras attach、oras manifest。

常用示例

登录仓库:

oras login registry.example.com -u "$USER" -p "$PASSWORD"

推送制品:

oras push registry.example.com/artifacts/app:1.0.0 \
  --artifact-type application/vnd.example.config.v1+json \
  ./config.yaml:application/yaml \
  ./sbom.json:application/spdx+json

拉取制品:

oras pull registry.example.com/artifacts/app:1.0.0 -o ./out

查看引用和附件:

oras discover registry.example.com/artifacts/app:1.0.0
oras attach registry.example.com/artifacts/app:1.0.0 \
  --artifact-type application/vnd.in-toto+json \
  ./provenance.json

查看 manifest:

oras manifest fetch registry.example.com/artifacts/app:1.0.0

易错点与排错

相关命令

参考链接

读完自测

合上页面,先回答,再展开对照。

  1. 推送 OCI 制品时返回 404/405,常见原因是什么?
  2. artifact type 和 media type 写错会怎样?
  3. 删除 tag 是否等于删除制品数据?
答案
  1. 仓库不支持 OCI artifact。
  2. 客户端无法识别制品,需要按规范填写。
  3. 不等于,删除 tag 不会删除所有关联的 blob,要注意仓库 GC。
微信小程序码:扫码打开命令速查小程序

小程序版

微信扫码,随时查命令