{"id":63433,"date":"2025-04-29T09:10:32","date_gmt":"2025-04-29T01:10:32","guid":{"rendered":"https:\/\/fwq.ai\/blog\/63433\/"},"modified":"2025-04-29T09:10:32","modified_gmt":"2025-04-29T01:10:32","slug":"docker%e6%80%8e%e4%b9%88%e8%ae%be%e7%bd%ae%e4%b8%ad%e6%96%87-2","status":"publish","type":"post","link":"https:\/\/fwq.ai\/blog\/63433\/","title":{"rendered":"docker\u600e\u4e48\u8bbe\u7f6e\u4e2d\u6587"},"content":{"rendered":"<blockquote><p>\n  \u5728 docker \u5bb9\u5668\u5185\u8bbe\u7f6e\u4e2d\u6587\u7684\u65b9\u6cd5\u5305\u62ec\uff1a\u4f7f\u7528 -e \u9009\u9879\u521b\u5efa\u5bb9\u5668\u5e76\u8bbe\u7f6e lang \u73af\u5883\u53d8\u91cf\uff1b\u8fdb\u5165\u5bb9\u5668\u5e76\u4f7f\u7528 echo $lang \u9a8c\u8bc1\u8bbe\u7f6e\uff1b\u5b89\u88c5\u5fc5\u8981\u7684\u5b57\u4f53\uff1b\u4fee\u6539 \/etc\/locale.gen \u6587\u4ef6\u5e76\u6dfb\u52a0 zh_cn.utf-8 \u9009\u9879\uff1b\u8fd0\u884c locale-gen \u547d\u4ee4\u751f\u6210 locale\uff1b\u91cd\u65b0\u542f\u52a8\u5bb9\u5668\u3002\n<\/p><\/blockquote>\n<p><img decoding=\"async\" src=\"https:\/\/img.php.cn\/upload\/article\/202404\/02\/2024040222181881602.jpg\" class=\"aligncenter\" title=\"docker\u600e\u4e48\u8bbe\u7f6e\u4e2d\u6587\u63d2\u56fe\" alt=\"docker\u600e\u4e48\u8bbe\u7f6e\u4e2d\u6587\u63d2\u56fe\" \/><\/p>\n<p><strong>\u5982\u4f55\u8bbe\u7f6e Docker \u4e2d\u7684\u4e2d\u6587<\/strong><\/p>\n<p><strong>\u5f00\u95e8\u89c1\u5c71<\/strong>\uff1a\u5728 Docker \u5bb9\u5668\u5185\u8bbe\u7f6e\u4e2d\u6587\u6b65\u9aa4\uff1a<\/p>\n<p><strong>\u8be6\u7ec6\u6b65\u9aa4<\/strong>\uff1a<\/p>\n<ol>\n<li> <strong>\u521b\u5efa\u5bb9\u5668<\/strong>\uff1a\u4f7f\u7528  run \u547d\u4ee4\u521b\u5efa\u5bb9\u5668\uff0c\u5e76\u52a0\u5165 -e LANG=zh_CN.UTF-8 \u9009\u9879\u3002\u4f8b\u5982\uff1a<\/li>\n<\/ol>\n<pre>docker run -itd --name my-container ubuntu:20.04 -e LANG=zh_CN.UTF-8<\/pre>\n<p> \u767b\u5f55\u540e\u590d\u5236 <\/p>\n<ol>\n<li> <strong>\u8fdb\u5165\u5bb9\u5668<\/strong>\uff1a\u4f7f\u7528 docker exec \u547d\u4ee4\u8fdb\u5165\u5bb9\u5668\u3002\u4f8b\u5982\uff1a<\/li>\n<\/ol>\n<pre>docker exec -it my-container \/bin\/bash<\/pre>\n<p> \u767b\u5f55\u540e\u590d\u5236 <\/p>\n<ol>\n<li> <strong>\u9a8c\u8bc1\u8bed\u8a00\u8bbe\u7f6e<\/strong>\uff1a\u5728\u5bb9\u5668\u5185\u8fd0\u884c echo $LANG \u547d\u4ee4\uff0c\u786e\u8ba4 LANG \u73af\u5883\u53d8\u91cf\u503c\u5df2\u8bbe\u7f6e\u4e3a zh_CN.UTF-8\u3002<\/li>\n<li> <strong>\u5b89\u88c5\u5b57\u4f53<\/strong>\uff1a\u5982\u679c\u9700\u8981\u4f7f\u7528\u4e2d\u6587\u5b57\u4f53\uff0c\u9700\u8981\u5728\u5bb9\u5668\u5185\u5b89\u88c5\u9002\u5f53\u7684\u5b57\u4f53\u3002\u4f8b\u5982\uff0c\u4f7f\u7528 apt-get \u5b89\u88c5\u5fae\u8f6f\u96c5\u9ed1\u4f53\uff1a<\/li>\n<\/ol>\n<pre>apt-get update &amp;&amp; apt-get install msttcorefonts -y<\/pre>\n<p> \u767b\u5f55\u540e\u590d\u5236 <\/p>\n<ol>\n<li> <strong>\u4fee\u6539\u914d\u7f6e\u6587\u4ef6<\/strong>\uff1a\u7f16\u8f91\u76f8\u5e94\u914d\u7f6e\u6587\u4ef6\u5e76\u8bbe\u7f6e\u4e2d\u6587\u8bed\u8a00\u3002\u4f8b\u5982\uff0c\u4fee\u6539 \/etc\/locale.gen \u6587\u4ef6\u5e76\u6dfb\u52a0 zh_CN.UTF-8 \u9009\u9879\uff1a<\/li>\n<\/ol>\n<pre>nano \/etc\/locale.gen<\/pre>\n<p> \u767b\u5f55\u540e\u590d\u5236 <\/p>\n<p>\u6dfb\u52a0\u4ee5\u4e0b\u884c\uff1a<\/p>\n<pre>zh_CN.UTF-8 UTF-8<\/pre>\n<p> \u767b\u5f55\u540e\u590d\u5236 <\/p>\n<p>\u4fdd\u5b58\u6587\u4ef6\u5e76\u8fd0\u884c locale-gen \u547d\u4ee4\u751f\u6210 locale\uff1a<\/p>\n<pre>locale-gen<\/pre>\n<p> \u767b\u5f55\u540e\u590d\u5236 <\/p>\n<ol>\n<li> <strong>\u91cd\u65b0\u542f\u52a8\u5bb9\u5668<\/strong>\uff1a\u4f7f\u7528 docker restart \u547d\u4ee4\u91cd\u65b0\u542f\u52a8\u5bb9\u5668\u3002\u4f8b\u5982\uff1a<\/li>\n<\/ol>\n<pre>docker restart my-container<\/pre>\n<p> \u767b\u5f55\u540e\u590d\u5236 <\/p>\n<p>\u4ee5\u4e0a\u5c31\u662f\u600e\u4e48\u8bbe\u7f6e\u4e2d\u6587\u7684\u8be6\u7ec6\u5185\u5bb9\uff0c\u66f4\u591a\u8bf7\u5173\u6ce8FDCServers\u5176\u5b83\u76f8\u5173\u6587\u7ae0\uff01<\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u5728 docker \u5bb9\u5668\u5185\u8bbe\u7f6e\u4e2d\u6587\u7684\u65b9\u6cd5\u5305\u62ec\uff1a\u4f7f\u7528 -e \u9009\u9879\u521b\u5efa\u5bb9\u5668\u5e76\u8bbe\u7f6e lang \u73af\u5883\u53d8\u91cf\uff1b\u8fdb\u5165\u5bb9\u5668\u5e76\u4f7f\u7528 echo $lang \u9a8c\u8bc1\u8bbe\u7f6e\uff1b\u5b89\u88c5\u5fc5\u8981\u7684\u5b57\u4f53\uff1b\u4fee\u6539 \/etc\/locale.gen \u6587\u4ef6\u5e76\u6dfb\u52a0 zh_cn.utf-8 \u9009\u9879\uff1b\u8fd0\u884c locale-gen \u547d\u4ee4\u751f\u6210 locale\uff1b\u91cd\u65b0\u542f\u52a8\u5bb9\u5668\u3002 \u5982\u4f55\u8bbe\u7f6e Docker \u4e2d\u7684\u4e2d\u6587 \u5f00\u95e8\u89c1\u5c71\uff1a\u5728 Docker \u5bb9\u5668\u5185\u8bbe\u7f6e\u4e2d\u6587\u6b65\u9aa4\uff1a \u8be6\u7ec6\u6b65\u9aa4\uff1a \u521b\u5efa\u5bb9\u5668\uff1a\u4f7f\u7528 run \u547d\u4ee4\u521b\u5efa\u5bb9\u5668\uff0c\u5e76\u52a0\u5165 -e LANG=zh_CN.UTF-8 \u9009\u9879\u3002\u4f8b\u5982\uff1a docker run -itd &#8211;name my-container ubuntu:20.04 -e LANG=zh_CN.UTF-8 \u767b\u5f55\u540e\u590d\u5236 \u8fdb\u5165\u5bb9\u5668\uff1a\u4f7f\u7528 docker exec \u547d\u4ee4\u8fdb\u5165\u5bb9\u5668\u3002\u4f8b\u5982\uff1a docker exec -it my-container \/bin\/bash \u767b\u5f55\u540e\u590d\u5236 \u9a8c\u8bc1\u8bed\u8a00\u8bbe\u7f6e\uff1a\u5728\u5bb9\u5668\u5185\u8fd0\u884c echo $LANG \u547d\u4ee4\uff0c\u786e\u8ba4 LANG \u73af\u5883\u53d8\u91cf\u503c\u5df2\u8bbe\u7f6e\u4e3a [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[8],"tags":[],"class_list":["post-63433","post","type-post","status-publish","format-standard","hentry","category-os"],"_links":{"self":[{"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/posts\/63433","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/comments?post=63433"}],"version-history":[{"count":0,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/posts\/63433\/revisions"}],"wp:attachment":[{"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/media?parent=63433"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/categories?post=63433"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/tags?post=63433"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}