Apply Docker best practices

Apache 2.0

Apply a set of Docker best practices to Dockerfiles. This recipe applies security hardening, build optimization, and maintainability improvements based on CIS Docker Benchmark and industry best practices.

org.openrewrite.docker.DockerBestPractices
mod run . --recipe=org.openrewrite.docker.DockerBestPractices

Install it once from Recipe actions, then run it on every repository under the current directory. New to the Moderne CLI? Set it up.

Recipe list

It runs these recipes, in this order.

  1. Apply Docker security best practices
  2. Optimize Docker builds
  3. Normalize Docker Hub image names
  4. Use exec form for ENTRYPOINT and CMD