Follow

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use
Contact

"update-locale: Error: invalid locale settings" when using a Dockerfile

I’m getting an error when trying to install and set a custom locale in 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

Here is a snippet of my 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

Do you guys know how to solve this problem ? For your info, I don’t have access to the docker terminal.

MEDevel.com: Open-source for Healthcare and Education

Collecting and validating open-source software for healthcare, education, enterprise, development, medical imaging, medical records, and digital pathology.

Visit Medevel

>Solution :

What I do in this case:

sed -i -E 's/^# (fr_FR.UTF-8.*)/\1/' /etc/locale.gen
locale-gen
Add a comment

Leave a Reply

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use

Discover more from Dev solutions

Subscribe now to keep reading and get access to the full archive.

Continue reading