How to set an environment variable in a running docker container

前端 未结 11 1174
难免孤独
难免孤独 2020-11-29 23:28

If I have a docker container that I started a while back, what is the best way to set an environment variable in that running container? I set an environment variable initia

11条回答
  •  佛祖请我去吃肉
    2020-11-30 00:02

    Firstly you can set env inside the container the same way as you do on a linux box.

    Secondly, you can do it by modifying the config file of your docker container (/var/lib/docker/containers/xxxx/config.v2.json). Note you need restart docker service to take affect. This way you can change some other things like port mapping etc.

提交回复
热议问题