How does an OCI registry store something that is not a container image, such as a Helm chart, an SBOM or a model file?
answer
- same API, different media types
- files become layer blobs
- artifactType on the image manifest
- empty descriptor as config
basics
~20 sAs an ordinary OCI image manifest plus blobs: each file is uploaded as a layer blob with its own media type, and the artifact's type is declared in the manifest's artifactType field or, in older artifacts, by a type-specific config media type.
solid answer
~40 sThe distribution API is content-agnostic: a registry stores blobs and a manifest, whatever they hold. For a non-image artifact, each file is uploaded as a blob and listed in `layers` with its own media type. The artifact's type goes in the manifest's `artifactType` field (image-spec 1.1), and `config` is either an artifact-specific config blob or the empty descriptor `application/vnd.oci.empty.v1+json`, whose content is `{}`; when config is empty, `artifactType` must be set. Older artifacts carry their type only in the config media type. Helm charts are the familiar case: config `application/vnd.cncf.helm.config.v1+json`, chart layer `application/vnd.cncf.helm.chart.content.v1.tar+gzip`. That is why tooling falls back to `config.mediaType` when `artifactType` is missing. Implementations storing or copying manifests must not error on an unknown `artifactType`. ORAS is the generic client that packages files this way.
code
json · 17 lines{
"schemaVersion": 2,
"mediaType": "application/vnd.oci.image.manifest.v1+json",
"artifactType": "application/vnd.example+type",
"config": {
"mediaType": "application/vnd.oci.empty.v1+json",
"digest": "sha256:44136fa355b3678a1146ad16f7e8649e94fb4fc21fe77e8310c060f61caaff8a",
"size": 2
},
"layers": [
{
"mediaType": "application/vnd.example+type",
"digest": "sha256:e258d248fda94c63753607f7c4494ee0fcbe92f1a76bfdac795c9d84101eb317",
"size": 1234
}
]
}go deeper
Recall that a registry stores any content as blobs plus a manifest, and that media types, not the registry, say what the content is.
Explain artifactType, the empty descriptor and the config.mediaType fallback, and walk through how a Helm chart's manifest is laid out.
Anticipate what breaks when non-image artifacts arrive: unknown types in scanners and cleanup rules, very large single-layer blobs, and old artifacts that use the image config type.
Weigh one content-agnostic registry for every artifact against format-specific stores, considering how much tooling around the registry assumes everything in it is an image.
## The registry never knew what an image was The OCI distribution specification describes itself as **agnostic of content types**. A registry stores two things: **blobs**, which are opaque bytes addressed by digest, and **manifests**, which are JSON documents listing blobs through descriptors. Nothing in a push says "this is a container"; the media types inside the manifest say what the content is. That is why one registry can hold container images, Helm charts, SBOM documents, policy bundles and model files side by side, with the same authentication, replication and digest addressing for all of them. The OCI image specification makes this explicit: content other than container images may be packaged using the **image manifest** (`application/vnd.oci.image.manifest.v1+json`). There is no separate artifact manifest type in the current specification. ## The fields that describe an artifact - **`artifactType`**: an optional field on the image manifest (and on the image index) giving the type of the artifact, as a media-type string such as `application/vnd.example+type`. It **must** be set when `config.mediaType` is the empty value. - **`config`**: still required. For an artifact it is either a config blob with an artifact-specific media type, or the **empty descriptor**. - **The empty descriptor**: media type `application/vnd.oci.empty.v1+json`, content `{}`, size 2, digest `sha256:44136fa355b3678a1146ad16f7e8649e94fb4fc21fe77e8310c060f61caaff8a`. It exists because a zero-byte blob proved not to be supported everywhere. - **`layers`**: the artifact's files, each a blob with a media type describing that file. If an artifact needs no files, the spec suggests a single empty-descriptor layer. - **`annotations`**: free-form string metadata, such as a creation time. The image spec gives a three-way decision tree for artifact authors: | Artifact shape | `artifactType` | `config` | `layers` | |---|---|---|---| | No files at all (metadata only) | set | empty descriptor | one empty descriptor | | Files, no JSON config | set | empty descriptor | the files | | Files plus JSON config | set to the tooling's common value | an artifact-specific config blob | the files | ## artifactType versus config.mediaType `artifactType` arrived in image-spec 1.1. Before it, tools signalled type through `config.mediaType`, and artifacts created that way are still everywhere: - A **Helm chart** stored in an OCI registry uses config `application/vnd.cncf.helm.config.v1+json`, a chart layer `application/vnd.cncf.helm.chart.content.v1.tar+gzip`, and, when a provenance file is pushed, a further layer `application/vnd.cncf.helm.chart.provenance.v1.prov`. - Some older tools went further and used the **image config media type** with artifact-specific layer types, because of registry limitations at the time. The image spec calls these non-conformant. So readers apply a fallback: take `artifactType` if present, otherwise `config.mediaType`. The distribution spec builds the same rule into the referrers API, which reports a manifest's `artifactType` or, when it is missing, its config media type. ## What the registry has to get right 1. **Accept unknown types.** Implementations storing or copying image manifests must not error on an `artifactType` they do not recognise. 2. **Store exact bytes** of the manifest, as for any manifest, so the artifact's digest is stable. 3. **Serve large blobs**: a model file is often one multi-gigabyte layer, which pushes clients to chunked uploads (`POST`, then `PATCH` per chunk, then a closing `PUT`), and a registry may advertise `OCI-Chunk-Min-Length`. 4. **Show it sensibly**: products differ in how they display, scan or clean up types they do not recognise. Harbor, for example, documents its own annotation keys so a user-defined artifact can show metadata and an icon. ## ORAS, the generic client **ORAS** (OCI Registry As Storage) is a client and set of libraries, not a registry feature. `oras push` uploads files as layer blobs (default layer type `application/vnd.oci.image.layer.v1.tar`, or a type given after the file name) and writes the manifest, with `--artifact-type` setting `artifactType`. `oras attach` pushes an artifact whose `subject` points at an existing manifest, and `oras discover` lists those referrers. The registry needs nothing ORAS-specific; it only has to implement the distribution spec faithfully. ## Practical consequences - A chart, an SBOM and an image in one registry share digest pinning, replication and permissions. - Tag listing returns names, not types; to know what a tag holds, a client fetches the manifest and reads its media types. - Cleanup rules, scanners and dashboards written for images need checking before other artifact types land beside them.
- Why not reuse the image config media type for a chart or a model file?Some older tools did, because of registry limitations at the time. The image spec now says the config media type of an artifact must be artifact-specific or the empty value, and calls the old pattern non-conformant. Reusing the image config type can lead image-aware tools to treat the artifact as a runnable image, and it defeats the config.mediaType fallback for type detection.
- How can a client tell what a tag in an OCI registry holds without downloading the layers?Fetch only the manifest by tag and read it: artifactType if present, otherwise config.mediaType, plus the layer media types and annotations. The tag list itself carries no type information. For artifacts attached to an image through subject, the referrers response already lists each one's artifactType.
- What does ORAS add on top of the registry API?Only a client: it packages local files as layer blobs with chosen media types, sets artifactType and annotations, writes the manifest, and can attach artifacts to a subject, discover referrers and copy artifacts with their referrers. The registry stores the result like any other manifest and needs no ORAS-specific support.
- The OCI distribution API only accepts container images, so charts need a separate API.
- An artifact manifest drops the config descriptor and keeps only artifactType.
- Image-spec 1.1 defines a separate artifact manifest media type for non-image content.
- Without artifactType, nothing in the manifest can tell a reader what the artifact is.
- An empty-descriptor config means the artifact carries no content at all.