Docker compose file is not using .env variables
I have an .env file in my root directory and in my sub directory a docker compose file.
Path of docker-compose.yml as environment variable
I have to set a environment variable to the absolute path of the docker-compose.yml
file. I tried ${PWD}
(see below). However, as expected, PWD
is the path from where the docker compose command is executed and not the path of the docker-compose.yml
file.
use env file + environment in docker-compose.yml
i am workin on this docker compose file:
Docker Compose default environment variable substitution
docker-compose.yml
:
The Compose file ‘./docker-compose.yml’ is invalid when using –env-file
I’m trying to use a different .env file called: .env.production.local in my docker compose.