Linters
What is Hadolint? An introduction to the Dockerfile linter written in Haskell
Hadolint is a Dockerfile linter written in Haskell that validates inline bash. It parses the Dockerfile into an AST and applies rules on that AST. It uses ShellCheck to lint Bash code inside RUN instructions.
- Tool
- Hadolint
- Made by
- Hadolint
- Official site
- github.com/hadolint/hadolint
- Category
- Linters
Who makes Hadolint
Hadolint is published under the Hadolint name. Its official website is the hadolint repository on GitHub, linked below.
Official website: github.com/hadolint/hadolint
What Hadolint is for
Hadolint is for linting Dockerfiles. Rather than scanning the file as plain text, it parses the Dockerfile into an AST and applies its rules on that AST, so checks work on the structure of the file.
A Dockerfile often contains shell commands, so Hadolint also checks those. It uses ShellCheck to lint Bash code inside RUN instructions, which means the embedded shell is validated as well as the Dockerfile instructions around it.
It can also warn when images from untrusted registries are used in Dockerfiles.
Who Hadolint is for
The vendor does not state a target audience. The tool suits people who write and maintain Dockerfiles and want automated checks on them.
Several ways of running it are offered, so it fits different setups. You can use the online version, run it through Docker on most platforms, or run it with Podman. Prebuilt binaries are available for macOS, Windows and Linux, and it can be installed with Homebrew on macOS and Scoop on Windows.
Notable capabilities
Hadolint pairs Dockerfile-aware rules with flexible configuration and output. The list below covers the main capabilities.
- Parsing of the Dockerfile into an AST, with rules applied on that AST.
- Linting of Bash code inside RUN instructions through ShellCheck.
- Warnings when images from untrusted registries are used in Dockerfiles.
- Many output formats, including JSON, SARIF, SonarQube, Checkstyle and JUnit.
- Ignored rules set in a YAML configuration file.
- Overridable rule severities.
- Configuration through environment variables as well.
- Debian and Alpine container variants available for shell access.
How Hadolint fits linters
Hadolint belongs to the linters category as a tool aimed at one file type: the Dockerfile. It builds on another tool in the same space, since ShellCheck handles the Bash found in RUN instructions. That layering is a useful pattern in static analysis, where a specialized linter delegates embedded languages to a tool built for them.
In Linthelm's wider niche of linters, static analysis and code quality, Hadolint is notable for how well its output suits automation. Formats such as JSON, SARIF, SonarQube, Checkstyle and JUnit let results flow into other tooling. Ignored rules, severity overrides and environment variables let a team adjust what the linter reports without changing the Dockerfiles themselves.
Frequently asked questions
What is Hadolint used for?
Hadolint is used to lint Dockerfiles. It parses the Dockerfile into an AST, applies rules on that AST and validates inline bash.
Does Hadolint check shell commands in a Dockerfile?
Yes. It uses ShellCheck to lint Bash code inside RUN instructions.
How can I run Hadolint?
You can use the online version, run it through Docker or Podman, or use prebuilt binaries for macOS, Windows and Linux. It can also be installed with Homebrew on macOS and Scoop on Windows.
Which output formats does Hadolint support?
It supports many output formats, including JSON, SARIF, SonarQube, Checkstyle and JUnit.
Can I ignore Hadolint rules?
Yes. Ignored rules can be set in a YAML configuration file, and rule severities can be overridden.
Linthelm is independent and is not affiliated with Hadolint. Product names belong to their owners. Features change; confirm details on the official website.