问题描述
我知道,在Ubuntu中,您可以在 / etc / environment
中设置环境变量的默认值。我在Alpine linux中看不到该文件。
I know, with Ubuntu, you can set default values for environment variables in /etc/environment
; I do not see that file in Alpine linux. Is there a different location for setting system-wide defaults?
推荐答案
似乎在 / etc / profile中是否存在其他位置?
是我能找到的最好的地方。至少在其中设置了一些环境变量:
It seems that /etc/profile
is the best place I could find. At least, some environment variables are set there:
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
根据<$ c $的内容c> / etc / profile ,您可以在 /etc/profile.d/中创建扩展名为
,您每次都必须传递 .sh
的文件。 -login
来加载环境变量,例如 docker exec -it container sh-登录
。
According to the contents of /etc/profile
, you can create a file with .sh
extension in /etc/profile.d/
and you have to pass --login
every time to load the env variables e.g docker exec -it container sh --login
.
这篇关于在Alpine linux的哪里设置系统默认环境变量?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!