docker 容器启动时设置环境变量source
镜像启动时,自动执行的是~/.bashrc文件,所以,环境变量需要配置在该文件内,这样镜像启动时,可自动执行该文件,使环境变量生效。
vi ~/.bashrc
----------------------------------------------------------------------------------
# .bashrc
# User specific aliases and functions
alias rm='rm -i'
alias cp='cp -i'
alias mv='mv -i'
# Source global definitions
if [ -f /etc/bashrc ]; then
. /etc/bashrc
fi
export LC_ALL=zh_CN.utf8 #设置centos docker中文字符集
----------------------------------------------------------------------------------