Did you know docker-compose only takes environment variables from`.env` only?

Recently I have encountered an issue with docker compose. I have separated the environment files and declared todocker-compose.yaml like following,

    env_file:
      - .dev_env

When I ran docker compose up, it was not working on the compose itself but the container. because of environment variables. Then I found following solution for this.

docker compose --env-file .dev_env --env-file .prod_env up