尝试在 docker 中安装和设置自定义区域设置时遇到错误:
INFO[0040] cmd: /bin/sh
INFO[0040] args: [-c update-locale LANG=fr_FR.UTF-8]
INFO[0040] Running: [/bin/sh -c update-locale LANG=fr_FR.UTF-8]
perl: warning: Setting locale failed.
perl: warning: Please check that your locale settings:
LANGUAGE = "fr_FR:fr",
LC_ALL = "fr_FR.UTF-8",
LANG = "fr_FR.UTF-8"
are supported and installed on your system.
perl: warning: Falling back to the standard locale ("C").
*** update-locale: Error: invalid locale settings: LANG=fr_FR.UTF-8
error building image: error building stage: failed to execute command: waiting for process to exit: exit status 255
这是我的片段
Dockerfile
:
WORKDIR /app
RUN apt-get update && apt-get install -y \
build-essential \
curl \
software-properties-common \
git \
locales \
&& rm -rf /var/lib/apt/lists/*
RUN locale-gen fr_FR.UTF-8
ENV LANG=fr_FR.UTF-8
ENV LANGUAGE=fr_FR:fr
ENV LC_ALL=fr_FR.UTF-8
RUN update-locale LANG=fr_FR.UTF-8
COPY . .
RUN pip3 install -r requirements.txt
你们知道如何解决这个问题吗?供您参考,我无法访问 docker 终端。
在这种情况下我会做什么:
sed -i -E 's/^# (fr_FR.UTF-8.*)/\1/' /etc/locale.gen
locale-gen