Manage environment variables in Docker configurations with appropriate scope, placement, and documentation:

  1. Set environment variables with appropriate scope:

    Not this:

    ENV DEBIAN_FRONTEND=noninteractive RUN apt-get update && apt-get install -y package1 package2 ```

  2. Place variables logically:
  3. Document variables properly:
  4. Clean up unnecessary variables: