简体   繁体   中英

Environment variable and docker-compose

When running a number of linked services with docker-compose up , how can I add values for environment variables to be passed to specific containers for services? Say I have a service "webapp" which uses the TIMEOUT environment variable, how do I set TIMEOUT=10000 with docker-compose for the container that "webapp" lives in? I have tried the notation -e TIMEOUT=10000 from the docker command, but this does not seem to work.

with docker compose your have to specify environment variables in docker-compose.yml with env_file or environment configuration commands

https://docs.docker.com/compose/compose-file/#env-file https://docs.docker.com/compose/compose-file/#environment

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM