Reputation: 2393
I'm trying to install a locale file in my Docker image, but for some reason it doesn't install correctly.
These lines inside my Dockerfile
do configure + install the locale files:
# 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
The image is created succesfully. When I run docker exec **ID** locale -a
I still get the following error:
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
So I guess it didn't installed the locale files correctly. Anyone could help me with this?
Upvotes: 1
Views: 6173
Reputation: 31
A bit to late but, I hope this helps someone else. Had similar isue and the following comands work for me
# syntax=docker/dockerfile:1
FROM ubuntu:22.04
# Set the locale
RUN apt-get update && apt-get install -y locales \
locales-all
RUN locale-gen nl_NL.UTF-8
ENV LANG nl_NL.UTF-8
ENV LANGUAGE nl_NL:nl
ENV LC_ALL nl_NL.UTF-8
RUN update-locale LANG=nl_NL.UTF-8
Upvotes: 2
Reputation: 1226
Try both locales
and locales-all
like :
RUN apt-get update && apt-get install -y --no-install-recommends \
locales \
locales-all \
Upvotes: 5