Skip to content

Docker容器—CentOS中文乱码/时区混乱问题 #70

Description

@johnnian

方案1:DockerFile

FROM centos
MAINTAINER http://fengwan.blog.51cto.com
RUN rm -rf /etc/localtime && ln -s /usr/share/zoneinfo/Asia/Shanghai /etc/localtime  #修改时区 
RUN yum -y install kde-l10n-Chinese && yum -y reinstall glibc-common  #安装中文支持 
RUN localedef -c -f UTF-8 -i zh_CN zh_CN.utf8  #配置显示中文 
ENV LC_ALL zh_CN.utf8  #设置环境变量 

方案2: 手动修改

进入Docker容器的命令行,执行下面操作:

yum -y install kde-l10n-Chinese && yum -y reinstall glibc-common
localedef -c -f UTF-8 -i zh_CN zh_CN.utf8
export LC_ALL=zh_CN.utf8

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions