All Dockerfile linters are either a command line tool or a webpage and they borrow the best practices from Docker’s “Best practices for writing Dockerfiles“. I am listing here the most popular tools to lint Dockerfiles.

  1. hadolint: opensource linter written in Haskell. Rules are basically defined in code as seen in the Rule.sh source file here. There is also a fork of it here.
  2. dockerfile lint: this is the linter provided by the project atomic. This Linter runs in nodejs. Rules are defined via regular expressions as seen in here. This linter is based on the dockerfile checker which is written on Python and also reads the rules from a YAML file called dockerfile_rules.yaml.
  3. Dockerlint: another nodejs linter. Rules are written in CoffeeScript.
  4. Plug-ins for Visual Studio Code: Visual Studio Code plug-ins offer the richiest developer experience. They offer autocomplete for Dockerfiles and Docker compose plus syntax highlighting. The most complete plugin is Docker Support from Microsoft, there are other plug-ins including the Docker Linter and CodeLift (requires an online account).
  5. Linter for dockerfile: this is a project from RedHat Labs. I didn’t find any detail about its internal working.rh_linter

 

Regards,

Javier Andrés Cáceres Alvis

Microsoft Most Valuable Professional – MVP

Intel Black Belt Software Developer