将环境变量从docker传递到supervisord

Upv*_*ote 6 supervisord docker

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

docker run -d --name foobar -e STAGE=testing -e STAGE_URL=http://...
Run Code Online (Sandbox Code Playgroud)

以及启动两个进程的主管的dockerfile踢:

CMD ["/usr/bin/supervisord", "--configuration", "/etc/supervisor/conf.d/supervisord.conf"]
Run Code Online (Sandbox Code Playgroud)

supervisord.conf我尝试读取变量:

[program:build]
priority=1
autorestart=false
directory=/app/foobar
command=grunt build --force --stage ${STAGE} --stage-url ${STAGE_URL}
Run Code Online (Sandbox Code Playgroud)

我也尝试过

$STAGE
Run Code Online (Sandbox Code Playgroud)

%(STAGE)s
Run Code Online (Sandbox Code Playgroud)

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

--stage STAGE --stage-url STAGE_URL
Run Code Online (Sandbox Code Playgroud)

代替

--stage testing --stage-url http://...
Run Code Online (Sandbox Code Playgroud)

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

Ass*_*vie 8

试试%(ENV_STAGE)s.

文档似乎表明这是要走的路.