如何在Debian/Ubuntu Docker容器内设置语言环境? [英] How to set the locale inside a Debian/Ubuntu Docker container?

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

问题描述

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

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

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

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.

我尝试过:

locale-gen nb_NO.UTF-8

但没有任何变化.如何在Docker容器中设置语言环境和键盘?

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

推荐答案

在Dockerfile中放入从

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/

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

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