Methods to set Chinese in a Docker container include: using the -e option to create the container and set the LANG environment variable; enter the container and use echo $LANG to verify the settings; install the necessary fonts; modify /etc/locale.gen file and add the zh_CN.UTF-8 option; run the locale-gen command to generate the locale; restart the container.
How to set Chinese in Docker
Get straight to the point: Set Chinese in Docker container Steps:
Detailed steps:
<code>docker run -itd --name my-container ubuntu:20.04 -e LANG=zh_CN.UTF-8</code>
<code>docker exec -it my-container /bin/bash</code>
<code>apt-get update && apt-get install msttcorefonts -y</code>
<code>nano /etc/locale.gen</code>
Add the following lines:
<code>zh_CN.UTF-8 UTF-8</code>
Save the file and run the locale-gen command to generate the locale :
<code>locale-gen</code>
<code>docker restart my-container</code>
The above is the detailed content of How to set up docker in Chinese. For more information, please follow other related articles on the PHP Chinese website!