← All notes

Docker build annotations: OCI metadata on manifests, indexes, and descriptors

Answer: Annotations provide descriptive metadata for images, including OCI manifests, indexes, and descriptors.

Annotations versus labels and attestations

Annotations record arbitrary information on an image so consumers and tools can see its origin, contents, and how to use it.

Annotations are similar to labels, but they attach to different things. Manifests, indexes, and descriptors take annotations. Images, containers, networks, and volumes take labels.

The OCI image specification defines the annotation format and a set of pre-defined keys. Following that standard lets tools such as Docker Scout surface metadata automatically.

Do not mix these up with attestations, which describe how an image was built and what it contains and are attached as their own manifest. Annotations are arbitrary metadata on the config, index, or manifest.

Adding and targeting annotations

You can add annotations at build time, or when creating the image manifest or index.

The Docker Engine image store cannot load images that have annotations. Build with --push, or use the registry exporter, so the image goes straight to a registry.

On the command line, docker build --push --annotation "foo=bar" . sets an annotation. In Bake, a target can set annotations = ["foo=bar"] and output type=registry. You can also annotate with docker buildx imagetools create, which supports annotations on an index or on manifest descriptors.

By default, annotations are added to the image manifest. The supported types are manifest, index, manifest-descriptor, and index-descriptor. The build must produce the component that you specify.

You can name more than one type, separated by commas, to attach the same annotation at more than one level, such as index,manifest:foo=bar. A platform qualifier in square brackets limits the annotation, for example manifest[linux/amd64]:foo=bar applies only to that manifest.

See also

Claims

Sources

License: this note is CC BY 4.0 (https://creativecommons.org/licenses/by/4.0/). Summary by iinventedlight (AI-assisted). Sources: Docker, Inc., Annotations; Docker, Inc., Annotations (source). Apache-2.0 (https://raw.githubusercontent.com/docker/docs/main/LICENSE). Copyright Docker, Inc. Text was condensed and changed from the originals.

License: CC-BY-4.0 · Summary by iinventedlight (AI-assisted). Sources: Docker, Inc., Annotations; Docker, Inc., Annotations (source). Apache-2.0 (https://raw.githubusercontent.com/docker/docs/main/LICENSE). Copyright Docker, Inc.

Cite this

Permanent ID: iil:note:p6bmr658

iinventedlight. 2026. "Docker build annotations: OCI metadata on manifests, indexes, and descriptors." iinventedlight Library, iil:note:p6bmr658, version of 2026-11-27. https://iinventedlight.com/library/notes/docker-build-annotations/. License: CC-BY-4.0.

@misc{iil_note_p6bmr658,
  author = {{iinventedlight}},
  title = {{Docker build annotations: OCI metadata on manifests, indexes, and descriptors}},
  howpublished = {iinventedlight Library},
  year = {2026},
  date = {2026-11-27},
  url = {https://iinventedlight.com/library/notes/docker-build-annotations/},
  note = {Permanent ID iil:note:p6bmr658. License: CC-BY-4.0.},
}

Markdown

Spotted a mistake? Use the MCP feedback tool or email hello@iinventedlight.com. Or Report a correction (no account needed).

Extra files beside this note

These files use this note's license, shown below. Paper extras retain their reproduction status; a link is not a reproduction.

All artifact files (JSON index)

For language models and agents: start at /llms.txt | /agents.md | /.well-known/agent-library.json. This page in Markdown: /library/notes/docker-build-annotations.md.