docker配置中文字符集
[ ~]# docker run -it -d centos:7 [ /]# echo $LANG [ /]# locale # 查看当前系统所使用的字符集 LANG= LC_CTYPE="POSIX" LC_NUMERIC="POSIX" LC_TIME="POSIX" LC_COLLATE="POSIX" LC_MONETARY="POSIX" LC_MESSAGES="POSIX" LC_PAPER="POSIX" LC_NAME="POSIX" LC_ADDRESS="POSIX" LC_TELEPHONE="POSIX" LC_MEASUREMENT="POSIX" LC_IDENTIFICATION="POSIX" LC_ALL= [ /]# locale -a | grep CN # 默认没有中文 [ /]# locale -a | grep zh [ /]# locale -a C POSIX en_AG en_AG.utf8 en_AU en_AU.iso88591 en_AU.utf8 en_US en_US.iso88591 en_US.iso885915 en_US.utf8 [ /]# yum install -y kde-l10n-Chinese # 需要执行命令进行安装 [ /]# yum reinstall -y glibc-common [ /]# yum groupinstall "fonts" -y [ /]# yum install -y system-config-language [ /]# localedef -c -f UTF-8 -i zh_CN zh_CN.UFT-8 # 定义字符集 [ /]# localedef -c -f GBK -i zh_CN zh_CN.GBK [ /]# localedef -c -f GB2312 -i zh_CN zh_CN.GB2312 [ /]# locale -a C POSIX en_US.utf8 zh_CN.gb2312 zh_CN.gbk zh_CN.uft8 [ /]# cat /etc/locale.conf LANG="en_US.UTF-8" [ /]# echo ‘LANG="zh_CN.UTF-8"‘ > /etc/locale.conf # 修改系统字符集 [ /]# cat /etc/locale.conf LANG="zh_CN.UTF-8" [ /]# source /etc/locale.conf [ /]# echo ‘export LC_ALL="zh_CN.utf8"‘ >> /etc/profile [ /]# source /etc/profile [ /]# locale LANG=zh_CN.UTF-8 LC_CTYPE="zh_CN.uft8" LC_NUMERIC="zh_CN.uft8" LC_TIME="zh_CN.uft8" LC_COLLATE="zh_CN.uft8" LC_MONETARY="zh_CN.uft8" LC_MESSAGES="zh_CN.uft8" LC_PAPER="zh_CN.uft8" LC_NAME="zh_CN.uft8" LC_ADDRESS="zh_CN.uft8" LC_TELEPHONE="zh_CN.uft8" LC_MEASUREMENT="zh_CN.uft8" LC_IDENTIFICATION="zh_CN.uft8" LC_ALL=zh_CN.uft8 #### 如果还出现乱码,执行以下命令 #### [ fonts]# cd /usr/share/fonts/ [ fonts]# fc-cache -fv #### 生成镜像 ########## docker commit -m ‘test‘ e265924baa80 centos:7-utf8 ########### dockerfile ############################################## FROM centos:7 RUN ln -sf /usr/share/zoneinfo/Asia/Shanghai /etc/localtime && yum -y install kde-l10n-Chinese && yum -y reinstall glibc-common && localedef -c -f UTF-8 -i zh_CN zh_CN.UTF-8 && echo ‘LANG="zh_CN.UTF-8"‘ > /etc/locale.conf && source /etc/locale.conf && yum clean all ENV LANG=zh_CN.UTF-8 LC_ALL=zh_CN.UTF-8
相关推荐
王道革 2020-11-25
bwyyziq 2020-11-22
pigsmall 2020-11-19
changecan 2020-11-19
helloWorldAndYou 2020-11-16
nginxs 2020-11-14
红石丶 2020-11-13
WanKaShing 2020-11-12
yangkang 2020-11-12
滴水穿石点石成金 2020-11-12
张荣珍 2020-11-12
wuxunanjing 2020-11-11
魅惑青花瓷 2020-11-11
lihongtai 2020-11-09
yangkang 2020-11-09
worldsnow 2020-11-06
MichaelJScofield 2020-11-06
TaoTaoFu 2020-11-06