Skip to main content

DockSec vs Hadolint

As with Trivy: DockSec runs Hadolint. It is a dependency, not a rival.

The relationship

Hadolint is the Dockerfile linter. DockSec calls it with -f json, maps its output into the same finding shape as everything else, and applies a documented severity mapping:

Hadolint levelDockSec severity
errorHIGH
warningMEDIUM
infoLOW
styleLOW

That mapping is a deliberate, conservative convention rather than a measurement, and it is stated plainly in the limitations because reasonable people would map it differently.

Where Hadolint and trivy config both report the same problem, a tested collision map decides the winner - Trivy takes precedence, and Hadolint's line number is carried across when Trivy lacks one.

What DockSec adds

HadolintDockSec
Dockerfile rulesThe engineRuns Hadolint, plus trivy config
Image CVEsNoYes, via Trivy
Compose filesNoYes, 17 rules plus chain analysis
PrioritisationNoEPSS tiering
FixesAdvice in the messageRunnable commands and --fix
Line numbers in SARIFYesYes, carried through

When to use Hadolint alone

  • You only lint Dockerfiles and do not scan images. Hadolint is a single fast binary with no other dependencies, and DockSec would be overhead.
  • You want the raw rule set without severity remapping.
  • Pre-commit on every save. Hadolint is quick enough for that; a full DockSec scan is not.

A reasonable setup is Hadolint in pre-commit for instant feedback, DockSec in CI for the full picture. DockSec ships a pre-commit hook too, if you would rather run one tool.