在Docker中更改Ubuntu语言环境 [英] Change Ubuntu locale in Docker
问题描述
所以我要在pt_BR中使用Ubuntu和Postgresql设置docker映像,我想知道如何通过命令行更改默认语言环境而无需重新启动系统-这在Docker构建中是不可能的:) .
我在Debian中设法通过更改/etc/default/locale
中的设置LANG,LANGUAGE和LC_ *变量,修改了/etc/locale.gen
并运行了dpkg-reconfigure
来做到这一点,如
So I'm setting up a docker image with Ubuntu and Postgresql in pt_BR and I'd like to know how can I change the default locale via command line without restarting the system - which is not possible in a Docker build :).
I managed to do it in Debian by changing setting LANG,LANGUAGE and LC_* variables in /etc/default/locale
, modifying /etc/locale.gen
and running dpkg-reconfigure
, as shown here. In Ubuntu it doesn't work.
推荐答案
它应该同样适用于Ubuntu.
It should work with Ubuntu similarly.
一个示例Dockerfile
A sample Dockerfile
FROM ubuntu
RUN apt-get install -y language-pack-pt-base
ENV LANG pt_BR.UTF-8
从该图像运行容器,ls --help
将以葡萄牙语显示.
Running a container from that image, ls --help
will be presented in Portuguese.
这篇关于在Docker中更改Ubuntu语言环境的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!