Skip to main content

hadolint

Supported VersionLanguageWebsite
2.6.0Dockerfilehttps://hadolint.github.io/hadolint

hadolint is a Dockerfile linter that helps you build best practice Docker images.

Getting Started#

To start using hadolint, enable it in your repository settings.

If you want to customize your hadolint analysis, create a file named .hadolint.yaml and put it into your repository.

Configuration#

Here is a configuration example via sider.yml:

linter:  hadolint:    target: "src/Dockerfile"    ignore: "DL3003"    trusted-registry: "my-company.com:500"    config: custom-hadolint.yml

You can use the following options to fine-tune hadolint to your project.

NameTypeDefault
root_dirstring-
targetstring, string[]**/Dockerfile{,.*}
ignorestring, string[]-
trusted-registrystring, string[]-
configstring-

target#

This option allows you to specify files or glob patterns to analyze. If you specify some targets, configure as follows:

linter:  hadolint:    target:      - "backend/Dockerfile"      - "images/**/Dockerfile"

ignore#

This option allows you to ignore some rules from result of analysis. You can specify rules as follows:

linter:  hadolint:    ignore:      - "DL3002"      - "DL3003"

See also the --ignore option.

trusted-registry#

This option can warn you when images from untrusted repositories are being used in Dockerfiles. If you specify some trusted repositories, configure as follows:

linter:  hadolint:    trusted-registry:      - "my-company.com:500"

See also the --trusted-registry option.

config#

This option allow you to specify configuration file in yaml format like this example. If you specify path to configuration file, configure as follows:

linter:  hadolint:    config: custom-hadolint.yml

See also the --config option.