Containers are taking over the development/deployment world and Docker is leading the charge. However, with this, the importance of Docker image security also becomes a priority for organizations and developers. Hence, it’s important to make sure that Dockerfiles are free of errors, security issues, and follow the best practices followed by the industry. Dockerfile linters help the developers in this task by scanning the Dockerfile instructions and highlighting the issues. The lab in this section deals with Dockerfile linting using different open-source tools.

 

What will you learn?

  • Analyze Dockerfile with different Dockerfile linters

  • Find and understand Dockerfile security/performance issues identified by the tools 

  • Fix the issues in accordance with the tool’s recommendations (if available)

References:

  1. Best practices for writing Dockerfiles  (https://docs.docker.com/develop/develop-images/dockerfile_best-practices)  

  2. Dockerfile (https://docs.docker.com/engine/reference/builder/)

Labs:

  • Dockerfile Linter

    In this lab, you will learn to analyze a Dockerfile and inspect it for errors and best practices. A non-exhaustive list of activities to be covered includes: 

    • Analyze the Dockerfile with Dockerfile Linter

    • Understand the issues outlined by the tool and fix those


  • Dockerfilelint

    In this lab, you will learn to analyze a Dockerfile and inspect it for errors and best practices. A non-exhaustive list of activities to be covered includes: 

    • Analyze the Dockerfile with Dockerfilelint

    • Understand the issues outlined by the tool and fix those


  • Dockerlint

    In this lab, you will learn to analyze a Dockerfile and inspect it for errors and best practices. A non-exhaustive list of activities to be covered includes: 

    • Analyze the Dockerfile with Dockerlint

    • Understand the issues outlined by the tool and fix those


  • Hadolint

    In this lab, you will learn to analyze a Dockerfile and inspect it for errors and best practices. A non-exhaustive list of activities to be covered includes: 

    • Analyze the Dockerfile with Hadolint

    • Understand the issues outlined by the tool and fix those

User Avatar

Dockerfile Linter

User Avatar

Dockerfilelint

User Avatar

Dockerlint

User Avatar

Hadolint