I’m starting the containers using podman compose
. The compose.yaml
like this,
services:
db:
image: mysql:8.0
restart: always
env_file:
- .env.local
ports:
- 5432:5432
and varialbes are defined in .env.local
like this,
# use by Drizzle ORM
DATABASE_USERNAME=dummy
DATABASE_PASSWORD=secret
DATABASE_NAME=demo
# use to start MySQL container
MYSQL_DATABASE=demo
MYSQL_USER=dummy
MYSQL_PASSWORD=secret
MYSQL_ROOT_PASSWORD=supersecret
the above configuration are working fine.
Now that there are duplicated variables like DATABASE_USERNAME
and MYSQL_DATABASE
and I tried to simplify the .env.local
like this,
DATABASE_USERNAME=dummy
DATABASE_PASSWORD=secret
DATABASE_NAME=demo
MYSQL_DATABASE=${DATABASE_USERNAME}
MYSQL_USER=${DATABASE_USERNAME}
MYSQL_PASSWORD=${MYSQL_PASSWORD}
MYSQL_ROOT_PASSWORD=supersecret
and it looks like the interpolation does not work. Do you know what am I missing here?
See also Interpolation in Compose file specification