Change Ubuntu locale in Docker

2019-07-17 03:27发布

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.

1条回答
太酷不给撩
2楼-- · 2019-07-17 03:57

It should work with Ubuntu similarly.

A sample Dockerfile

FROM ubuntu
RUN  apt-get install -y language-pack-pt-base
ENV  LANG pt_BR.UTF-8

Running a container from that image, ls --help will be presented in Portuguese.

查看更多
登录 后发表回答