---
source: https://iinventedlight.com/library/notes/docker-build-sbom.md
title: "Docker SBOM attestations: SPDX inventory attached during a build"
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., SBOM attestations; Docker, Inc., SBOM attestations (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-sbom"
tags: [docker, sbom, spdx, attestations, buildkit]
client: Librarian
sources:
  - id: S1
    title: "SBOM attestations"
    publisher: Docker, Inc.
    url: https://docs.docker.com/build/metadata/attestations/sbom/
    accessed: 2026-11-27
    license: "Apache License 2.0"
  - id: S2
    title: "SBOM attestations (source)"
    publisher: Docker, Inc.
    url: https://raw.githubusercontent.com/docker/docs/main/content/manuals/build/metadata/attestations/sbom.md
    accessed: 2026-11-27
    license: "Apache License 2.0"
---
# Docker SBOM attestations: SPDX inventory attached during a build
**Answer:** Docker can attach an SPDX SBOM attestation to an image during a BuildKit build.

## What an SBOM attestation records

SBOM attestations support software supply chain transparency by listing artifacts an image contains and artifacts used to create it.

Metadata for those artifacts may include name, version, license type, authors, and a unique package identifier.

If scanning happens as part of the build, you can detect software used to build the image that may not show up in the final image.

BuildKit generates SBOMs that follow the SPDX standard and attaches them as a JSON-encoded SPDX document, using the in-toto SPDX predicate format.

## Creating, checking, and widening the scan

Pass --attest type=sbom to docker buildx build, or the shorthand --sbom=true, to create the attestation.

Validate the SBOM before you push. Building with the local exporter writes attestations as JSON in the export root, including sbom.spdx.json.

By default, BuildKit only scans the final stage, so build-time dependencies from earlier stages or from the build context can be missed. A FROM scratch final stage is a common example.

BUILDKIT_SBOM_SCAN_CONTEXT and BUILDKIT_SBOM_SCAN_STAGE widen the scan. These arguments are special: variable substitution does not work, and you cannot set them from environment variables. The only way to set these values is an explicit ARG in the Dockerfile.

Passing the option only as a CLI argument, without an ARG declaration in the Dockerfile, will have no effect.

## See also

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

## Claims

- id: C1
  claim: Pass --attest type=sbom, or the shorthand --sbom=true, to create an SBOM attestation.
  source: S1
  evidence: "To create an SBOM attestation, pass the --attest type=sbom"

- id: C2
  claim: By default BuildKit only scans the final stage of an image.
  source: S2
  evidence: "By default, BuildKit only scans the final stage of an image."

- id: C3
  claim: The generated SBOM follows SPDX and is attached as JSON using an in-toto predicate.
  source: S1
  evidence: "follow the SPDX standard and attach to the final image as a JSON-encoded"

## Sources

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

- [S2] SBOM attestations (source). Docker, Inc.. https://raw.githubusercontent.com/docker/docs/main/content/manuals/build/metadata/attestations/sbom.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., SBOM attestations; Docker, Inc., SBOM attestations (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).
