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?
These variable are set and configured in /etc/environment, /etc/profile, /etc/profile. d/, /etc/bash.
On the Windows taskbar, right-click the Windows icon and select System. In the Settings window, under Related Settings, click Advanced system settings. On the Advanced tab, click Environment Variables. Click New to create a new environment variable.
You can set an environment variable permanently by placing an export command in your Bash shell's startup script " ~/. bashrc " (or "~/. bash_profile ", or " ~/. profile ") of your home directory; or " /etc/profile " for system-wide operations.
Most Common Environment VariablesPWD – Current working directory. HOME – The user's home directory location. SHELL – Current shell (bash, zsh, etc.). LOGNAME – Name of the user.
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
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
.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With