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

19 8

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

Sentry image

See why 4M developers consider Sentry, “not bad.”

Fixing code doesn’t have to be the worst part of your day. Learn how Sentry can help.

Learn more

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

AWS Security LIVE!

Join us for AWS Security LIVE!

Discover the future of cloud security. Tune in live for trends, tips, and solutions from AWS and AWS Partners.

Learn More

👋 Kindness is contagious

Please leave a ❤️ or a friendly comment on this post if you found it helpful!

Okay