Logo

dev-resources.site

for different kinds of informations.

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

Published at
6/11/2023
Categories
discuss
docker
compose
env
Author
Mohamad Ashraful Islam
Categories
4 categories in total
discuss
open
docker
open
compose
open
env
open
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

Featured ones: