且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

如何在 Debian/Ubuntu Docker 容器中设置语言环境?

更新时间:2022-05-02 22:22:22

在你的 Dockerfile 中放入一些改编自

Put in your Dockerfile something adapted from

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

如果您运行 Debian 或 Ubuntu,您还需要安装 locales 以拥有 locale-gen

If you run Debian or Ubuntu, you also need to install locales to have locale-gen with

apt-get -y install locales

这是从关于该主题的非常好的帖子中提取的,来自

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

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