Dockerfile labels should not duplicate git provenance labels generated by Buildx.Documentation Index
Fetch the complete documentation index at: https://tally.wharflab.com/llms.txt
Use this file to discover all available pages before exploring further.
| Property | Value |
|---|---|
| Severity | Warning |
| Category | Correctness |
| Default | Enabled, models BUILDX_GIT_LABELS=full |
| Auto-fix | Suggestion, when org.opencontainers.image.revision can be mapped precisely |
Description
Buildx can generate image labels from the current git checkout whenBUILDX_GIT_LABELS is enabled. Manually maintaining the same keys in the
Dockerfile can leave stale source, revision, or Dockerfile-path metadata on the
image.
org.opencontainers.image.revision means the source control revision of the
packaged content. A Dockerfile cannot know that value reliably unless the build
system injects it for the exact checkout being built. When Buildx is already
configured to generate the revision label, the Dockerfile label is redundant at
best and stale at worst.
This rule checks labels that affect the exported image. Labels in throwaway
builder stages are ignored unless the final image inherits from that stage.
Buildx modes
| Mode | Generated labels checked |
|---|---|
off, none, or strconv.ParseBool false values such as false, 0, f, F | Disabled |
strconv.ParseBool true values such as true, 1, t, T | org.opencontainers.image.revision, com.docker.image.source.entrypoint |
full | The true labels plus org.opencontainers.image.source |
Examples
Bad
Good
Fixes
ForLABEL org.opencontainers.image.revision=..., Tally offers two
suggestion-level fixes when the source pair can be mapped precisely:
- comment out the instruction, preserving the original text for review
- delete the instruction or pair
org.opencontainers.image.revision appears inside a grouped LABEL,
Tally removes only that key/value pair and preserves the unrelated labels. The
comment-out fix inserts a commented standalone LABEL before the grouped
instruction, then removes the active pair from the group.
Fixes are scoped to the exported image’s stage chain. If a final stage shadows
an inherited org.opencontainers.image.revision, the suggested fix also removes
the inherited copy so applying the fix once does not reveal the same issue
again. Builder-only stages outside the exported chain are still ignored.
org.opencontainers.image.source and
com.docker.image.source.entrypoint are reported but not auto-fixed by this
rule; they may be intentional static project metadata in some build workflows.
Configuration
Tally does not infer builder configuration from its own process environment. By default, this rule modelsBUILDX_GIT_LABELS=full because the diagnostics
are informational and help keep git-derived metadata owned by the build system.
Configure the mode explicitly when the repository uses a narrower Buildx git
label policy. Boolean string values are parsed like Docker/Buildx documents
BUILDX_GIT_LABELS parsing: true, 1, t, and T all select the narrower
non-full generated-label set.
References
- Docker Build variables:
BUILDX_GIT_LABELS - Docker Buildx 0.10.0 release notes
- Docker object labels
- OCI image annotations