I have below structure
The project root .env
defines the path to either ./docker/dev/.env
or ./docker/prod/.env
as depicted below:
environment=dev
dot_env_path=./docker/dev/.env
My docker-compose.yml contains the below service snippet:
services:
db:
image: mysql:5.7
command: --default-authentication-plugin=mysql_native_password
restart: always
env_file: ${dot_env_path} <--notice this variable points to the actual .env
environment:
- MYSQL_ROOT_PASSWORD=${MYSQL_ROOT_PASSWORD}
- MYSQL_USER=${MYSQL_USER}
- MYSQL_PASSWORD=${MYSQL_PASSWORD}
ports:
- 3306:3306
expose:
- 3306
volumes:
- db-tmc:/var/lib/mysql
However, when I do docker-compose
build I receive below warnings; it's not detecting the ${dot_env_path}
and loading it's content
Any idea, much appreciated?