a
t
the format is ${RDS_HOSTNAME}, not ${env:RDS_HOSTNAME}
type this is bash source .env/file/path ; dockercommand
r
Doesn't docker compose pick up .env file automatically?
a
@tylim, thanks so much! is
file
the .env or docker-compose.yml file? I guess
path
is the path to .env file? What if the .env is at the root of the project, and the dockr-compose.yml file in nested inside a folder?
t
simply replace .env/file/path with .env file path relative to docker yml file
run the command in where the docker yml file is
i think i show you another way, there is some npm package that is really good 1. install env-cmd as dev dependency: npm i -D env-cmd 2. create a npm scripts is package json: "anyname":"env-cmd envpath docker-compose -f dockerymlpath up" 3. run the script in root directory, both env and yml path must be relative to root directory, this will inject environment variable when you run docker compose
a
Thank @tylim, I’ll give it a shot.