dockerÔõôÉèÖÃÖÐÎÄ
ÔÚ docker ÈÝÆ÷ÄÚÉèÖÃÖÐÎĵÄÒªÁì°üÀ¨£ºÊ¹Óà -e Ñ¡ÏÉèÈÝÆ÷²¢ÉèÖà lang ÇéÐαäÁ¿£»½øÈëÈÝÆ÷²¢Ê¹Óà echo $lang ÑéÖ¤ÉèÖã»×°ÖÃÐëÒªµÄ×ÖÌ壻ÐÞ¸Ä /etc/locale.gen Îļþ²¢Ìí¼Ó zh_cn.utf-8 Ñ¡ÏÔËÐÐ locale-gen ÏÂÁîÌìÉú locale£»ÖØÐÂÆô¶¯ÈÝÆ÷¡£
ÔõÑùÉèÖà Docker ÖеÄÖÐÎÄ
Ö±ÑÔ²»»ä£ºÔÚ Docker ÈÝÆ÷ÄÚÉèÖÃÖÐÎÄ°ì·¨£º
Ïêϸ°ì·¨£º
½¨ÉèÈÝÆ÷£ºÊ¹Óà docker run ÏÂÁÉèÈÝÆ÷£¬²¢¼ÓÈë -e LANG=zh_CN.UTF-8 Ñ¡Ïî¡£ÀýÈ磺
docker run -itd --name my-container ubuntu:20.04 -e LANG=zh_CN.UTF-8
µÇ¼ºó¸´ÖÆ
½øÈëÈÝÆ÷£ºÊ¹Óà docker exec ÏÂÁî½øÈëÈÝÆ÷¡£ÀýÈ磺
docker exec -it my-container /bin/bash
µÇ¼ºó¸´ÖÆ
ÑéÖ¤ÓïÑÔÉèÖãºÔÚÈÝÆ÷ÄÚÔËÐÐ echo $LANG ÏÂÁȷÈÏ LANG ÇéÐαäÁ¿ÖµÒÑÉèÖÃΪ zh_CN.UTF-8¡£
×°ÖÃ×ÖÌ壺ÈôÊÇÐèҪʹÓÃÖÐÎÄ×ÖÌ壬ÐèÒªÔÚÈÝÆ÷ÄÚ×°ÖÃÊʵ±µÄ×ÖÌå¡£ÀýÈ磬ʹÓà apt-get ×°ÖÃ΢ÈíÑźÚÌ壺
apt-get update && apt-get install msttcorefonts -y
µÇ¼ºó¸´ÖÆ
ÐÞ¸ÄÉèÖÃÎļþ£º±à¼ÏìÓ¦ÉèÖÃÎļþ²¢ÉèÖÃÖÐÎÄÓïÑÔ¡£ÀýÈ磬ÐÞ¸Ä /etc/locale.gen Îļþ²¢Ìí¼Ó zh_CN.UTF-8 Ñ¡Ï
nano /etc/locale.gen
µÇ¼ºó¸´ÖÆ
Ìí¼ÓÒÔÏÂÐУº
zh_CN.UTF-8 UTF-8
µÇ¼ºó¸´ÖÆ
ÉúÑÄÎļþ²¢ÔËÐÐ locale-gen ÏÂÁîÌìÉú locale£º
locale-gen
µÇ¼ºó¸´ÖÆ
ÖØÐÂÆô¶¯ÈÝÆ÷£ºÊ¹Óà docker restart ÏÂÁîÖØÐÂÆô¶¯ÈÝÆ÷¡£ÀýÈ磺
docker restart my-container
µÇ¼ºó¸´ÖÆ
ÒÔÉϾÍÊÇdockerÔõôÉèÖÃÖÐÎĵÄÏêϸÄÚÈÝ£¬¸ü¶àÇë¹Ø×¢±¾ÍøÄÚÆäËüÏà¹ØÎÄÕ£¡