python - Using docker environment -e variable in supervisor -


i've been trying pass in environment variable docker container via -e option. variable meant used in supervisor script within container. unfortunately, variable not resolved (i.e. stay instance$instancename). tried ${var} , "${var}", didn't either. there can or not possible?

the docker run command:

sudo docker run -d -e "instancename=instance-1" -e "foo=2" -v /var/app/tmp:/var/app/tmp -t myrepos/app:tag 

and supervisor file:

[program:app] command=python test.py --param1=$foo stderr_logfile=/var/app/log/$instancename.log directory=/var/app autostart=true 

the variable being passed container, supervisor doesn't let use environment variables inside configuration files.

you should review supervisor documentation, , parts string expressions. example, command option:

note value of command may include python string expressions, e.g. /path/to/programname --port=80%(process_num)02d might expand /path/to/programname --port=8000 @ runtime.

string expressions evaluated against dictionary containing keys group_name, host_node_name, process_num, program_name, here (the directory of supervisord config file), , supervisord’s environment variables prefixed env_.


Comments

Popular posts from this blog

python - No exponential form of the z-axis in matplotlib-3D-plots -

php - Best Light server (Linux + Web server + Database) for Raspberry Pi -

c# - "Newtonsoft.Json.JsonSerializationException unable to find constructor to use for types" error when deserializing class -