set environment variable in running docker contianer

前端 未结 2 762
遇见更好的自我
遇见更好的自我 2021-01-24 14:27

I need to set environment variable in a running docker container. I am already aware of the way of setting environment variable while creating a container. As far I found there

2条回答
  •  情深已故
    2021-01-24 15:26

    If you have a running process in the docker and you are attempting to change the environment variable in the docker so the running process will dynamically change - this will not work. The environment variables of a process are set when it starts. You can see here ways to overcome that, but I don't think that is the right way to go.

    I would instead, have a configuration file that the file reads (or listens to) periodically. And when you want to change the configuration change the file.

    If this isn't your scenario, please describe your scenario so we can better assist you.

提交回复
热议问题