Hadolint

Hadolint

Hadolint is Dockerfile linter, validate inline bash, written in Haskell

It wasn’t made recently, it was born in 2016.

Agenda

  • Lint Dockerfile on local
  • Configure hadolint to ignore speicific rules
  • Hadolint in Hana Cloud

Haskell Dockerfile Linter

A smarter Dockerfile linter that helps you build best practice Docker images. The linter parses the Dockerfile into an AST and performs rules on top of the AST. It stands on the shoulders of ShellCheck to lint the Bash code inside RUN instructions.

Install

1
> brew install hadolint

Run on CLI

1
2
3
4
5
> hadolint Dockerfile
Dockerfile:1 DL3007 warning: Using latest is prone to errors if the image will ever update. Pin the version explicitly to a release tag

// ignore DL3007.
> hadolint --ignore DL3007 Dockerfile

Configures

Use configurtion files .hadolint.yaml

1
2
3
ignored:
  - DL3007
  - SC1010

VSCode extension

There is an official hadolint extension.

Hadolint in HanaCloud Microservice delivery