docker的centos7出现的乱码:
在这里插入图片描述

#查看本地的中文语言包

[root@61c1a2f92913 ~]# locale  -a
C
POSIX
en_US.utf8
[root@61c1a2f92913 ~]# 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=

安装中文环境包(centos7)

yum install kde-l10n-Chinese -y

设置环境变量

 vim  /etc/profile
 export LC_ALL="zh_CN.UTF-8"
 更新环境变量
 source /etc/profile

此时已经支持中文了

locale
LANG=
LC_CTYPE="zh_CN.UTF-8"
LC_NUMERIC="zh_CN.UTF-8"
LC_TIME="zh_CN.UTF-8"
LC_COLLATE="zh_CN.UTF-8"
LC_MONETARY="zh_CN.UTF-8"
LC_MESSAGES="zh_CN.UTF-8"
LC_PAPER="zh_CN.UTF-8"
LC_NAME="zh_CN.UTF-8"
LC_ADDRESS="zh_CN.UTF-8"
LC_TELEPHONE="zh_CN.UTF-8"
LC_MEASUREMENT="zh_CN.UTF-8"
LC_IDENTIFICATION="zh_CN.UTF-8"

设置locale.conf

vim /etc/locale.conf 
LANG="zh_CN.UTF-8"
source /etc/locale.conf 

设置系统语言

[root@61c1a2f92913 ~]# localedef -c -f UTF-8 -i zh_CN zh_CN.utf8

在这里插入图片描述

Logo

权威|前沿|技术|干货|国内首个API全生命周期开发者社区

更多推荐