我正在尝试在Docker镜像中安装语言环境文件,但是由于某种原因,它无法正确安装。

我的Dockerfile中的这些行可以配置+安装语言环境文件:

# Install and configure locales
RUN ["apt-get", "install", "-y", "locales"]
RUN ["locale-gen", "nl_NL.UTF-8"]
RUN ["dpkg-reconfigure", "locales"]
RUN ["update-locale"]
ENV LANG nl_NL.UTF-8

图像创建成功。当我运行docker exec **ID** locale -a时,仍然出现以下错误:
locale: Cannot set LC_CTYPE to default locale: No such file or directory
locale: Cannot set LC_MESSAGES to default locale: No such file or directory
locale: Cannot set LC_COLLATE to default locale: No such file or directory
C
C.UTF-8
POSIX

因此,我猜它没有正确安装语言环境文件。有人可以帮助我吗?

最佳答案

尝试localeslocales-all
喜欢 :

RUN apt-get update && apt-get install -y --no-install-recommends \
    locales \
    locales-all \

10-08 12:21