DEV Community

Cover image for A quick way to detect bad practices on a Dockerfile

A quick way to detect bad practices on a Dockerfile

luzfcb profile image Fábio C. Barrionuevo da Luz ・1 min read

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:

How to customize the validation

We can customize the validation by creating the .hadolint.yaml file:

How to integrate on the CI Server

There are several examples of how to use hadolint on CI servers:

Discussion (2)

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

Forem Open with the Forem app