Skip to content
BETAGuardrails are in beta. The library, the configuration format and the CLI command can still change.

Guardrails / iac

Dockerfile lint findings are clean

iac/dockerfile-lint-clean@v1

Every finding the Dockerfile linter reported sits below the severity the team gates on.

Idiac/dockerfile-lint-clean
Versionv1
Categoryiac
Default severitywarning
Interpreterpython3
Timeout30 seconds
Violations tolerated0
Collectsdocker

Collectors

This guardrail gathers nothing itself. It depends on the collectors below, which the CLI runs once per build before any check, and reads what they found out of GUARDRAIL_FACTS. A collector that collects nothing skips this guardrail rather than failing it.

CollectorGathersInputs it is given
dockerEvery Dockerfile in the tree, parsed without a tool: the stages it builds, the image each one starts from and how that image is pinned, the user the image ends as, the ports it exposes, the paths it copies in and the names of the build arguments and environment variables it declares, enriched with the findings of a hadolint report when the build already left one behind.none

The inputs above are this guardrail's own, passed straight through. Configuring one in buildnote.json changes what is collected, and two guardrails configured the same way share the one collection.

Configuration

json
{
  "guardrails": {
      "failOn": "error",
      "comment": true,
      "checks": [
          {
              "use": "iac/dockerfile-lint-clean@v1",
              "severity": "warning",
              "with": {
                  "severity": "high",
                  "ignore": ""
              },
              "exemptions": []
          }
      ]
  }
}

Inputs

InputDescriptionDefaultEnvironment variable
severityLowest severity that is a violation, on the scale the collector normalises every report onto. A finding below it is logged rather than reported. One of critical, high, medium, low, info.highGUARDRAIL_INPUT_SEVERITY
ignoreComma separated rule ids that are never a violation, such as DL3008,DL3059.``GUARDRAIL_INPUT_IGNORE

How to fix

Fix the findings named in the violations, or silence a rule deliberately in .hadolint.yaml where it does not apply:

yaml
ignored:
  - DL3008

Run the linter in the build before this guardrail so there is a report to read:

bash
hadolint --format sarif Dockerfile > hadolint.sarif

The report is read, never rerun: the guardrail judges the same findings the build acted on.

More in iac

All 11 iac guardrails

Buildnote Limited
Registered in England and Wales, Reg: 16140412