Updating Environment Variables of a Container using Docker

前端 未结 1 1424
走了就别回头了
走了就别回头了 2021-01-12 00:22

I\'ve setup a server with multiple docker containers, accessible with jwilders nginx reversre proxy. When you run the containers you can set the VIRTUAL_HOST environment var

1条回答
  •  小蘑菇
    小蘑菇 (楼主)
    2021-01-12 01:06

    Destroy your container and start a new one up with the new environment variable using docker run -e .... It's identical to changing an environment variable on a running process, you stop it and restart with a new value passed in. Replace the concept of restarting a process with destroying and recreating a new container.

    If your container contains files that cannot be lost, then you should be using volumes. The other contents of the container filesystem should be either disposable or immutable.

    0 讨论(0)
提交回复
热议问题