---
source: https://iinventedlight.com/library/notes/docker-build-annotations.md
title: "Docker build annotations: OCI metadata on manifests, indexes, and descriptors"
license: CC-BY-4.0
license_url: https://creativecommons.org/licenses/by/4.0/
source_license: "Apache License 2.0 (Docker, Inc.); Apache License 2.0 (Docker, Inc.); prose restates cited source lines in own words"
license_family: mixed-green
attribution: "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."
author: "iinventedlight (synthesis of cited sources); text drafted with AI assistance"
date: 2026-11-27
status: published
approved_by: "Cole Withington, 2026-11-27 14:30 PT: \"Yes, publish all of that now\""
checked_on: 2026-11-27
as_of: 2026-11-27
confidence: medium
untested: "Not reproduced (2026-11-27). Official docs and source files were read; no test suite, server, or API call was run for this note."
category: coding-references
topic_area: "code-devops: docker-build-annotations"
tags: [docker, annotations, oci, manifest, metadata]
client: Librarian
sources:
  - id: S1
    title: "Annotations"
    publisher: Docker, Inc.
    url: https://docs.docker.com/build/metadata/annotations/
    accessed: 2026-11-27
    license: "Apache License 2.0"
  - id: S2
    title: "Annotations (source)"
    publisher: Docker, Inc.
    url: https://raw.githubusercontent.com/docker/docs/main/content/manuals/build/metadata/annotations.md
    accessed: 2026-11-27
    license: "Apache License 2.0"
---
# 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

- [docker-build-attestations](https://iinventedlight.com/library/notes/docker-build-attestations/)
- [docker-build-provenance](https://iinventedlight.com/library/notes/docker-build-provenance/)
- [docker-build-sbom](https://iinventedlight.com/library/notes/docker-build-sbom/)

## Claims

- id: C1
  claim: Annotations provide descriptive metadata for images.
  source: S1
  evidence: "Annotations provide descriptive metadata for images"

- id: C2
  claim: By default, annotations are added to the image manifest.
  source: S2
  evidence: "By default, annotations are added to the image manifest"

- id: C3
  claim: Annotations should not be confused with attestations.
  source: S2
  evidence: "Annotations are not to be confused with"

## Sources

- [S1] Annotations. Docker, Inc.. https://docs.docker.com/build/metadata/annotations/ . License: Apache License 2.0. Accessed 2026-11-27.

- [S2] Annotations (source). Docker, Inc.. https://raw.githubusercontent.com/docker/docs/main/content/manuals/build/metadata/annotations.md . License: Apache License 2.0. Accessed 2026-11-27.

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.

---

Agents: [/agents.md](/agents.md) | [/.well-known/agent-library.json](/.well-known/agent-library.json).
