Skip to content
Français
Sync not enabled: your progress stays in this browser My learning
Select theme
Français

Understand OCI: image, distribution and runtime

By updated

Improve this page

A tag such as alpine:3.24.2 does not necessarily designate the same image from one day to the next, whereas a digest always designates the same content. This difference comes from the OCI format (Open Container Initiative), the standard that describes what an image is. It also sets how a registry (the server that stores images) distributes an image, and how a runtime (the program that starts the container) executes it. This page defines its vocabulary: tag, digest, manifest, index, configuration and layers. It needs no tool and can be read without Docker.

What you will learn

  • Name the three OCI specifications and say what each one defines
  • Tell a tag, a digest, a manifest, an index, a configuration and a layer apart
  • Read an OCI manifest
  • Choose between a tag and a digest to designate an image

Prerequisites

What is OCI?

The Open Container Initiative is the organization that publishes the open standards for containers. Its three specifications cover the whole life of an image, from its description to its execution.

SpecificationWhat it defines
ImageThe format of an image: manifest, configuration, layers
DistributionThe HTTP API of a registry: pushing and pulling images
RuntimeHow to run a container from a folder and a config.json file; runc is the reference implementation

Thanks to this standard, an image built with one tool runs with another (Docker, Podman, containerd, CRI-O), and a registry such as Docker Hub, Harbor, Quay or GHCR speaks the same language to all of them. The lesson Run an OCI bundle with runc and read its config.json puts the Runtime specification into practice; this page covers Image and Distribution.

What documents make up an OCI image?

An OCI image is a manifest that points to a configuration and to layers, each document being named by its digest. The digest is the SHA-256 fingerprint of the content: the content determines the name, never the other way round.

In the diagram, follow the arrows from the tag. It points to the manifest, which in turn references the configuration and each layer by their digest.

In an OCI registry, the tag alpine:3.24.2 points to the manifest, which references the configuration and the layers by their digest; each object is identified by its SHA-256.Tag alpine:3.24.2readable name, can changeManifest sha256:xxx…lists configuration and layersConfigurationsha256:aaa…Layer 1sha256:bbb…Layer 2sha256:ccc…OCI registry
Source · SVG
Esc to close, + and − to zoom, scroll to move around. 100 %
ObjectContentName
ManifestThe list of the configuration and the layers, with their digests and sizessha256:…
ConfigurationThe metadata of the image: platform, environment variables, command, user, portssha256:…
LayerA tar archive of the files added, modified or deletedsha256:…

The digest of an image is the digest of its manifest (or of its index, see below): if the manifest changes, even by one byte, the digest changes. Since the manifest contains the digests of the configuration and of the layers, knowing the digest of the manifest is enough to verify the whole image.

What does a tag designate, and what does a digest designate?

A tag is a readable name that the publisher can move to other content, whereas a digest designates one precise content forever. The tag is convenient for humans. The digest is the reference that pins the content you get.

The notation for a reference that carries both is name:tag@sha256:…. For example, the following reference designates the alpine 3.24.2 image by the digest of its index, a top-level document described below:

docker.io/library/alpine:3.24.2@sha256:294b683cb724975bec92580e1e685676bd4b50bda910ddb8c51d4cabeaec77e6

The table gives the reference to use depending on the context.

ContextReferenceWhy
Local developmentTagReadable, convenient
Publishing a versionVersioned tag, digest recorded at publicationThe tag is readable, the digest can be found again
Deployment, auditDigestSame content every time, exact trace

A versioned tag such as 3.24.2 is not immutable for all that: it can be republished, unless the registry forbids it through a policy. In production, designate the image by its digest.

Your turn

You note that production runs alpine:3.24.2. In a month, a colleague has to run exactly the same image again. What do you hand over, and why is the tag alone not enough?

A hint

Ask yourself what the tag designates today, and what it could designate in a month.

I have tried: show the answer

Hand over the digest, in the form name@sha256:…. The tag is a name that the publisher can republish to point to another manifest: in a month, alpine:3.24.2 may designate a different image. The digest is computed on the content, so it can only designate that content.

What does a manifest contain?

A manifest is a JSON document that points to the configuration and to each layer by their digest, size and type. The form below is simplified, and the digests are shortened.

{
"schemaVersion": 2,
"mediaType": "application/vnd.oci.image.manifest.v1+json",
"config": {
"mediaType": "application/vnd.oci.image.config.v1+json",
"digest": "sha256:aaa...",
"size": 1234
},
"layers": [
{
"mediaType": "application/vnd.oci.image.layer.v1.tar+gzip",
"digest": "sha256:bbb...",
"size": 5678
}
]
}

The mediaType field says which type of document it is: a manifest, a configuration, a tar layer compressed with gzip. Registries serve two manifest formats, Docker's (application/vnd.docker.distribution.manifest.v2+json) and OCI's (application/vnd.oci.image.manifest.v1+json). The common tools read both.

What is an index?

An index is a document that lists several manifests, one per platform. A platform combines an operating system and a processor architecture, such as linux/amd64 or linux/arm64. A tag can therefore designate either a manifest, for an image made for a single platform, or an index, for an image published for several.

In the second case, the client, the tool that downloads the image, picks from the index the manifest that matches its machine, then downloads its layers. The digest of the tag is then the digest of the index, which differs from that of each manifest it lists. The lessons of the Docker training go further on this point: Read an OCI image and its identity reads the index and the manifest that a container used, and Build an image for several architectures publishes an index.

What do the configuration and the layers contain?

The configuration says how to run the image, the layers contain the files. The configuration holds the platform (architecture, os), the config section (environment variables, command and entrypoint, user, working directory, declared ports), the rootfs list of the fingerprints of the uncompressed layers (diff_ids) and the build history.

Each layer is a tar archive, often compressed. Its digest in the manifest covers the stored object, that is the archive as stored (compressed, when it is), whereas its diff_id in the configuration covers the uncompressed archive. The first one is used to verify what the client downloads, the second one identifies the content of the layer whatever its compression. The lesson Read an OCI image and verify its digest recomputes both.

What other objects can a registry store?

An OCI registry does not store only images: it also accepts other artifacts, such as Helm charts (the packages of Kubernetes applications), signatures or software bills of materials (SBOMs), which attach to an image through its digest. This topic belongs to the supply chain: ORAS (in French) is the tool for it, and Check what an image contains, and who signed it shows its use on the Docker side.

Which vocabulary should you remember?

The table lists the terms of the page, from the outermost to the innermost.

TermDefinition
RegistryServer that stores and distributes images according to the Distribution specification
TagReadable, movable name that designates a manifest or an index
DigestSHA-256 fingerprint of a document, which identifies its content
IndexList of manifests, one per platform
ManifestDocument that points to the configuration and the layers of an image
ConfigurationMetadata of the image: platform, command, environment, user
LayerTar archive of the file differences with the previous layer

Key takeaways

  • OCI publishes three specifications: Image (the format), Distribution (the API of registries) and Runtime (the execution).
  • An OCI image is a manifest that points to a configuration and to layers, each named by its digest.
  • The digest is the SHA-256 fingerprint of a document: it changes as soon as one byte changes.
  • A tag is a movable name, a digest designates fixed content: in production, designate the image by its digest.
  • An index lists one manifest per platform, and a tag can designate an index rather than a manifest.
  • The digest of a layer covers the stored archive, its diff_id covers its uncompressed content.

Test your knowledge

This quiz asks seven questions drawn from thirteen. It checks that you can tell a tag from a digest, name the documents of an image and read a manifest.

Knowledge check

Check what you have learned with this interactive quiz

7 questions
7 min
80% to pass

How it works

  • The timer starts when you click Start
  • Multiple choice, true/false and short answer questions
  • You can move between questions
  • Detailed results are shown at the end

Starts the quiz and the timer