一个运行中的Docker容器怎么修改执行run命令时的环境变量
PHP中文网
PHP中文网 2017-04-25 09:01:19
0
3
721

一个运行中的Docker容器怎么修改执行run命令时的环境变量

PHP中文网
PHP中文网

认证0级讲师

reply all(3)
大家讲道理

Enter the containerdocker exec -it containerId/Names /bin/bash,再使用export修改就可以了吧
export ENV='value'

我想大声告诉你

Hello, it is not recommended to change the configuration of a running container. The container itself is stateless. Of course, it can also be changed by entering the inside of the container:

docker exec -it <容器id> </bin/bash|/bin/sh>

Such changes cannot be saved persistently. When the container is restarted, the changes will be lost. The correct approach is to put the data that needs to be persisted in the mounted storage volume, and directly delete and rebuild when the configuration needs to be changed.
PS: Portal /q/10...

左手右手慢动作

Thanks for the invitation, there is a very cool thing called docker-gen. You can try to see if it can solve your problem!

Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!