DEV Community

Cover image for A quick way to detect bad practices on a Dockerfile
Fábio C. Barrionuevo da Luz for Feldroy

Posted on

A quick way to detect bad practices on a Dockerfile

In Feldroy we use Docker images as the base to running the tools to build the PDF, EPUB, and Kindle files from the content written by @audreyfeldroy and @danielfeldroy .

Having a 100% functional Dockerfile that follows good practices is a good thing to have.

The hadolint is a linter tool that helps to validate a Dockerfile to build Docker images that follow the recommendations of the Best practices for writing Dockerfiles guide.

A quick way to use

docker run --rm -i hadolint/hadolint < Dockerfile

What is the validation rules

The validation follows these rules: https://github.com/hadolint/hadolint#rules

How to customize the validation

We can customize the validation by creating the .hadolint.yaml file: https://github.com/hadolint/hadolint#configure

How to integrate on the CI Server

There are several examples of how to use hadolint on CI servers: https://github.com/hadolint/hadolint/blob/master/docs/INTEGRATION.md

Top comments (1)

Collapse
 
waylonwalker profile image
Waylon Walker

Thanks for aharing. As a docker noob this will definitely help guide me.

Some comments have been hidden by the post's author - find out more