我知道,在 Ubuntu 中,您可以在 /etc/environment
中设置环境变量的默认值;我在 Alpine linux 中没有看到该文件。是否有不同的位置用于设置系统范围的默认值?
最佳答案
看来/etc/profile
是我能找到的最好的地方。至少,在那里设置了一些环境变量:
export CHARSET=UTF-8
export PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin
export PAGER=less
export PS1='\h:\w\$ '
umask 022
for script in /etc/profile.d/*.sh ; do
if [ -r $script ] ; then
. $script
fi
done
根据/etc/profile
的内容,可以在/etc/profile.d/
中创建一个扩展名为.sh
的文件> 并且每次加载环境变量时都必须传递 --login
,例如 docker exec -it container sh --login
。
关于configuration - Alpine linux 在哪里设置系统默认环境变量?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/35325856/