Enforce Dockerfile best practices automatically by using a static code analysis tool such as hadolint linter, that will detect and alert for issues found in a Dockerfile.
hadolint parses a Dockerfile and shows a warning for any errors that do not match its best practice rules.