docker重新进入容器时“/etc/profile”中环境变量失效问题的解决

原文地址:https://blog.csdn.net/dongdong9223/article/details/81094657

如果在docker中设置了环境变量,肯定希望下次进入容器时自动生效。如果是在:

/etc/profile

中设置的,再次进入容器时环境变量会失效,解决办法是将环境变量设置在:

/root/.bashrc

中,再次登录容器仍然有效。

更好的解决办法是使用Dockerfile构建镜像,并使用entrypoint进行配置。

原文地址:https://www.cnblogs.com/eyesfree/p/14765467.html