---
source: https://iinventedlight.com/library/notes/docker-build-checks.md
title: "Docker build checks: lint a Dockerfile before or 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., Build checks; Docker, Inc., Build checks (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-checks"
tags: [docker, buildkit, dockerfile, lint, checks]
client: Librarian
sources:
  - id: S1
    title: "Build checks"
    publisher: Docker, Inc.
    url: https://docs.docker.com/build/checks/
    accessed: 2026-11-27
    license: "Apache License 2.0"
  - id: S2
    title: "Build checks (source)"
    publisher: Docker, Inc.
    url: https://raw.githubusercontent.com/docker/docs/main/content/manuals/build/checks.md
    accessed: 2026-11-27
    license: "Apache License 2.0"
---
# Docker build checks: lint a Dockerfile before or during a build
**Answer:** Docker build checks validate a Dockerfile and build options before or during a build, as linting or a dry run.

## How checks run

Build checks arrived in Dockerfile 1.8. They validate build configuration and run a series of checks before the build executes.

Think of them as linting for the Dockerfile and build options, or as a dry-run mode.

With checks enabled, Docker inspects the Dockerfile and options you pass and reports issues instead of only executing the steps.

Checks help with validating your Dockerfile and build options before you run a build, and with identifying potential issues or anti-patterns.

Support starts at Buildx 0.15.0, docker/build-push-action 6.6.0, and docker/bake-action 5.6.0.

A normal build runs the checks by default and prints violations in the output. One example is JSONArgsRecommended when a CMD instruction does not use JSON array syntax.

With --debug, the output includes a documentation link for the check, plus a snippet of the Dockerfile.

docker build --check . runs the checks without executing the build steps.

## Failing or skipping checks

By default, violations are reported as warnings and the process exits 0.

A # check=error=true directive in the Dockerfile makes the build fail after the checks run, before the actual build starts.

The same error setting can be passed on the CLI with the BUILDKIT_DOCKERFILE_CHECK build argument.

A # check=skip=ID,ID directive, or the same CSV list in BUILDKIT_DOCKERFILE_CHECK, skips named checks. skip=all skips every check.

You can combine skip and error in one directive or build argument, separated by a semicolon.

## See also

- [docker-build-best-practices](https://iinventedlight.com/library/notes/docker-build-best-practices/)
- [docker-buildx-build](https://iinventedlight.com/library/notes/docker-buildx-build/)
- [docker-dockerignore](https://iinventedlight.com/library/notes/docker-dockerignore/)

## Claims

- id: C1
  claim: Build checks were introduced in Dockerfile 1.8 to validate configuration before a build.
  source: S1
  evidence: "Build checks are a feature introduced in Dockerfile 1.8."

- id: C2
  claim: docker build --check runs the checks without executing the build.
  source: S2
  evidence: "To run build checks without actually building, you can use"

- id: C3
  claim: By default, check violations are warnings and the process exits 0.
  source: S1
  evidence: "Check violations for builds are reported as warnings, with exit code 0, by"

## Sources

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

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