【云计算】Docker 镜像如何设置语言环境?bash: warning: setlocale: LC_ALL: cannot change locale (en_US)

时间:2024-11-20 09:07:56

解决方案:

# set default language environment
RUN locale-gen en_US.UTF- \
&& dpkg-reconfigure locales
ENV LC_ALL=en_US.UTF-
ENV LANG=en_US.UTF-
ENV LANGUAGE=en_US.UTF-8 OR:
sudo locale-gen en_US.UTF-8

sudo dpkg-reconfigure locales
vi /etc/default/locale
LC_ALL=en_US.UTF-8
LANG=en_US.UTF-8
重新登录服务器,warning 警告不再出现,问题解决
 

 

参考资料:

1、bash: warning: setlocale: LC_ALL: cannot change locale (en_US):

http://blog.163.com/fl_xiang/blog/static/194634512201291231429799/

https://www.xdty.org/912

https://blogs.oracle.com/sakshijain/entry/the_problem_of_setting_locale

http://www.cnblogs.com/ifantastic/p/4565822.html

http://www.tuicool.com/articles/qYrIvm/

2、How to source /etc/profile and save it in docker?

http://*.com/questions/31216780/how-to-source-etc-profile-and-save-it-in-docker

3、sudo命令报错

http://www.cnblogs.com/wangkongming/p/4451629.html