LinuxCommandLibrary

hadolint

dockerfile linter that validates best practices and common mistakes

TLDR

Lint Dockerfile

$ hadolint [Dockerfile]
copy
Lint from stdin
$ cat Dockerfile | hadolint -
copy
Ignore specific rules
$ hadolint --ignore [DL3008] [Dockerfile]
copy
Output as JSON
$ hadolint --format json [Dockerfile]
copy
Show trusted registries
$ hadolint --trusted-registry [docker.io] [Dockerfile]
copy

SYNOPSIS

hadolint [options] dockerfile

DESCRIPTION

Hadolint is a Dockerfile linter that validates best practices and common mistakes. It uses ShellCheck to validate shell commands in RUN instructions.
The tool checks for security issues, inefficient layering, and deprecated syntax. It helps create optimized, secure container images.

PARAMETERS

DOCKERFILE

Dockerfile to lint.
--ignore RULE
Ignore specific rule.
--format FMT
Output format (tty, json, codeclimate).
--trusted-registry REG
Trusted container registry.
--config FILE
Config file path.
--no-color
Disable colored output.
--help
Display help information.

CAVEATS

Shell checking requires bash syntax. Some rules may not apply to all use cases. Configuration file recommended.

HISTORY

Hadolint was created to improve Dockerfile quality by combining Docker best practices with ShellCheck's shell analysis.

SEE ALSO

> TERMINAL_GEAR

Curated for the Linux community

Copied to clipboard

> TERMINAL_GEAR

Curated for the Linux community