Sign inSign up

boxcutter/hadolint

By boxcutter

•Updated 18 days ago

Dockerfile linter, validate inline bash, written in Haskell.

Image
0

4.0K

boxcutter/hadolint repository overview

⁠hadolint

Hadolint is a linter for Containerfiles/Dockerfiles. It helps you build best practice⁠ container images.

We use this during the lint phase of our CI pipelines for container images.

This image packages releases from https://github.com/hadolint/hadolint⁠

Image source: https://github.com/boxcutter/oci/tree/main/hadolint⁠

⁠Using hadolint

To lint a Containerfile just pipe it to docker run:

docker container run --rm -i docker.io/boxcutter/hadolint < Containerfile

⁠CLI

docker container run --rm -i docker.io/boxcutter/hadolint hadolint --help
hadolint - Dockerfile Linter written in Haskell

Usage: hadolint [-v|--version] [-c|--config FILENAME] [DOCKERFILE...]
                [--file-path-in-report FILEPATHINREPORT] [-o|--output OUTPUT]
                [--no-fail] [--no-color] [-V|--verbose] [-f|--format ARG]
                [--error RULECODE] [--warning RULECODE] [--info RULECODE]
                [--style RULECODE] [--ignore RULECODE]
                [--trusted-registry REGISTRY (e.g. docker.io)]
                [--require-label LABELSCHEMA (e.g. maintainer:text)]
                [--strict-labels] [--disable-ignore-pragma]
                [-t|--failure-threshold THRESHOLD]

  Lint Dockerfile for errors and best practices

Available options:
  -h,--help                Show this help text
  -v,--version             Show version
  -c,--config FILENAME     Path to the configuration file
  --file-path-in-report FILEPATHINREPORT
                           The file path referenced in the generated report.
                           This only applies for the 'checkstyle',
                           'codeclimate', 'sonarqube', 'junit' and
                           'gitlab_codeclimate' formats and is useful when
                           running Hadolint with Docker to set the correct file
                           path.
  -o,--output OUTPUT       Output destination file
  --no-fail                Don't exit with a failure status code when any rule
                           is violated
  --no-color               Don't colorize output
  -V,--verbose             Enables verbose logging of hadolint's output to
                           stderr
  -f,--format ARG          The output format for the results [tty | json |
                           checkstyle | codeclimate | gitlab_codeclimate | gnu |
                           codacy | sonarqube | sarif | junit] (default: tty)
  --error RULECODE         Make the rule `RULECODE` have the level `error`
  --warning RULECODE       Make the rule `RULECODE` have the level `warning`
  --info RULECODE          Make the rule `RULECODE` have the level `info`
  --style RULECODE         Make the rule `RULECODE` have the level `style`
  --ignore RULECODE        A rule to ignore. If present, the ignore list in the
                           config file is ignored
  --trusted-registry REGISTRY (e.g. docker.io)
                           A docker registry to allow to appear in FROM
                           instructions
  --require-label LABELSCHEMA (e.g. maintainer:text)
                           The option --require-label=label:format makes
                           Hadolint check that the label `label` conforms to
                           format requirement `format`
  --strict-labels          Do not permit labels other than specified in
                           `label-schema`
  --disable-ignore-pragma  Disable inline ignore pragmas `# hadolint
                           ignore=DLxxxx`
  -t,--failure-threshold THRESHOLD
                           Exit with failure code only when rules with a
                           severity equal to or above THRESHOLD are violated.
                           Accepted values: [error | warning | info | style |
                           ignore | none] (default: info)

Tag summary

Content type

Image

Digest

sha256:7cda2c447…

Size

51.8 MB

Last updated

18 days ago

docker pull boxcutter/hadolint