I try to use some environment variable inside my docker compose file:
backend:
container_name: backend
build:
context: ./docker
dockerfile: Dockerfile.api-dev
args:
- API_NAME=backend
env_file:
- ./apps/backend/envs/.env.development
- ./docker/envs/.env.development
ports:
- ${PORT}:${PORT}
restart: always
depends_on:
- mongo_replica_1
- mongo_replica_2
- mongo_replica_3
networks:
- mongo_network
As you can see I provide env_file. There are 2 files. One of them has PORT configured. But when I run the docker-compose up I get a warning: WARN[0000] The "PORT" variable is not set. Defaulting to a blank string.
So where is the problem?