Reputation: 24397
I'm trying to build a Docker image based on oracle/database:11.2.0.2-xe
(which is based on Oracle Linux based on RHEL) and want to change the system locale in this image (using some RUN
command inside a Dockerfile
).
According to this guide I should use localectl set-locale <MYLOCALE>
but this command is failing with Failed to create bus connection: No such file or directory
message. This is a known Docker issue for commands that require SystemD to be launched.
I tried to start the SystemD anyway (using /usr/sbin/init
as first process as well as using -v /sys/fs/cgroup:/sys/fs/cgroup:ro -v /run
thanks to this help) but then the localectl set-locale
failed with Could not get properties: Connection timed out
message.
So I'm now trying to avoid the usage of localectl
to change my system globale locale, how could I do this?
Upvotes: 9
Views: 10063
Reputation: 24397
According to this good guide on setting locale on Linux, I should use
localedef -c -i fr_FR -f ISO-8859-15 fr_FR.ISO-8859-15
But this command failed with
cannot read character map directory `/usr/share/i18n/charmaps': No such file or directory`
This SO reply indicated one could use yum reinstall glibc-common -y
to fix this and it worked.
So my final working Dockerfile
is:
RUN yum reinstall glibc-common -y && \
localedef -c -i fr_FR -f ISO-8859-15 fr_FR.ISO-8859-15 && \
echo "LANG=fr_FR.ISO-8859-15" > /etc/locale.conf
ENV LANG fr_FR.ISO-8859-15
Upvotes: 11