[英]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? 使用docker-compose up
运行多个链接服务docker-compose up
,如何为要传递给服务的特定容器的环境变量添加值? 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? 假设我有一个使用TIMEOUT环境变量的服务“webapp”,如何使用docker-compose为“webapp”所在的容器设置TIMEOUT = 10000? I have tried the notation -e TIMEOUT=10000
from the docker
command, but this does not seem to work. 我在docker
命令中尝试了符号-e TIMEOUT=10000
,但这似乎不起作用。
with docker compose your have to specify environment variables in docker-compose.yml
with env_file
or environment
configuration commands 使用docker compose你必须使用env_file
或environment
配置命令在env_file
docker-compose.yml
指定环境变量
https://docs.docker.com/compose/compose-file/#env-file https://docs.docker.com/compose/compose-file/#environment https://docs.docker.com/compose/compose-file/#env-file https://docs.docker.com/compose/compose-file/#environment
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.