将环境变量从docker传递到supervisord

时间:2016-04-07 16:40:19

标签: docker supervisord

我使用docker run传递了两个env变量:

docker run -d --name foobar -e STAGE=testing -e STAGE_URL=http://...

并且dockerfile启动了一个启动几个进程的主管:

CMD ["/usr/bin/supervisord", "--configuration", "/etc/supervisor/conf.d/supervisord.conf"]

supervisord.conf我尝试阅读变量:

[program:build]
priority=1
autorestart=false
directory=/app/foobar
command=grunt build --force --stage ${STAGE} --stage-url ${STAGE_URL}

我也试过

$STAGE

%(STAGE)s

但是STAGE永远不会被视为变量。它永远不会被实际内容所取代。相反,它被视为一个简单的字符串。这导致:

--stage STAGE --stage-url STAGE_URL

而不是

--stage testing --stage-url http://...

这甚至可能我正在做什么?主管文档不清楚这个主题。有什么想法吗?

1 个答案:

答案 0 :(得分:7)

尝试%(ENV_STAGE)s

docs似乎暗示着要走的路。

相关问题