What should I do if docker displays Chinese garbled characters?

藏色散人
Release: 2022-01-20 14:09:28
Original
11734 people have browsed it

Solution to docker displaying garbled Chinese characters: 1. Check the supported languages ​​through the locale command; 2. Add the environment variable "LANG=en_ZW.utf8".

What should I do if docker displays Chinese garbled characters?

The operating environment of this article: centOS6.8 system, Docker version 20.10.11, Dell G3 computer.

What should I do if docker displays Chinese garbled characters?

Docker Chinese garbled characters

locale command to see which languages ​​are supported

[root@0ca5b90999e6 soft]# locale -a|grep utf8
en_AG.utf8
en_AU.utf8
en_BW.utf8
en_CA.utf8
en_DK.utf8
en_GB.utf8
en_HK.utf8
en_IE.utf8
en_IN.utf8
en_NG.utf8
en_NZ.utf8
en_PH.utf8
en_SG.utf8
en_US.utf8
en_ZA.utf8
en_ZM.utf8
en_ZW.utf8
Copy after login

Add environment variables

[root@0ca5b90999e6 soft]# vim /etc/profile   
LANG=en_ZW.utf8
[root@0ca5b90999e6 soft]# source /etc/profile
Copy after login

Note:

1. When docker runs, it is best to add /usr/sbin/init at the end to start systemd (according to requirements)

2. In addition, my dockerfile startup command is CMD /etc/init.d/sh /init.sh, one more script will be started, which will automatically source, so there is no need to rebuild the container

#!/bin/bash
source /etc/profile
/usr/sbin/sshd -D
/bin/bash
Copy after login

Recommended learning: "docker video tutorial"

The above is the detailed content of What should I do if docker displays Chinese garbled characters?. For more information, please follow other related articles on the PHP Chinese website!

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template