如何设置Docker容器内的区域? [英] How to set the locale inside a Docker container?

查看:87
本文介绍了如何设置Docker容器内的区域?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在运行Ubuntu Docker容器。我有一个挪威键盘,需要使用挪威字符(øæå)。



我的终端字符编码设置为UTF-8,我使用SSH连接到我的容器。但是,我无法输入挪威字符,也不能复制和粘贴挪威字符,也不能使用CTL + SHIFT + U + 00f8。



我试过:

  locale-gen nb_NO.UTF-8 

,但没有改变。如何将区域设置和键盘设置在Docker容器内?

解决方案

将Dockerfile中的东西从

 #设置语言环境
RUN sed -i -e's /#en_US.UTF-8 UTF-8 / en_US.UTF- 8 UTF-8 /'/etc/locale.gen&& \
locale-gen
ENV LANG en_US.UTF-8
ENV LANGUAGE en_US:en
ENV LC_ALL en_US.UTF-8

这是从这个主题的非常好的帖子中提取的,从



http://jaredmarkell.com/docker-and-locales/


I'm running a Ubuntu Docker container. I have a Norwegian keyboard and need to use Norwegian characters (øæå).

My Terminal character encoding is set to UTF-8 and I'm connected to my container using SSH. However, I'm unable to type Norwegian characters, nor copy and paste Norwegian characters, nor use CTL+SHIFT+U+00f8.

I tried:

locale-gen nb_NO.UTF-8

but nothing changed. How do I set the locale and keyboard inside a Docker container?

解决方案

Put in your Dockerfile something adapted from

# Set the locale
RUN sed -i -e 's/# en_US.UTF-8 UTF-8/en_US.UTF-8 UTF-8/' /etc/locale.gen && \
    locale-gen
ENV LANG en_US.UTF-8  
ENV LANGUAGE en_US:en  
ENV LC_ALL en_US.UTF-8     

this is extracted from the very good post on that subject, from

http://jaredmarkell.com/docker-and-locales/

这篇关于如何设置Docker容器内的区域?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆