docker - 如何修改运行中容器的配置
滿天的星座
滿天的星座 2017-04-25 09:01:22
0
3
1076

我开启一个docker容器:

容器中配置项目IP是:10.241.93.21。
现在由于网络环境的问题,ip地址变化了。需要将容易的IP换成10.241.61.20。

ps:要求不删除现有的容器,下次重启后ip地址还是10.241.61.20。
怎么配置?求方法。谢谢!

滿天的星座
滿天的星座

reply all(3)
左手右手慢动作

You are using it wrong. Containers should not be permanent things. To keep the container disposable, if there is a problem, it should be removed by rm, the data should be saved outside the container, and then the new container should be run directly. Parameter modifications were made at that time.

In addition, you should use DNS. If it is an internal machine, you can also use internal DNS instead of hard-coding the IP.

Both of these approaches have problems. As for modifying the configuration within the container, this is not recommended. The container is not a virtual machine, and the configuration within it should not be modified.

阿神

Are you using environment variables?

Look at the priority of environment variables and change the environment variables.

I’m not sure about the priority of environment variables. You can try to set environment variables by starting files like ~/.bashrc ~./.profile in the user directory

仅有的幸福

Have you solved it bro? I have the same problem

Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template