How to add language support on CentOS 7 (on Docker)?
I had the same problem with a RHEL 7.4 docker image. yum reinstall glibc-common
by itself didn't resolve the problem. It was only installing English.
I found in my docker container /etc/yum.conf
contained the line override_install_langs=en_US
. This caused yum reinstall glibc-common
to only install English.
With this line commented out (or changed to the default value of all), and re-running yum reinstall glibc-common
I was able to use other languages
Initial Environment after docker run/attach
# locale -a
C
POSIX
en_US.utf8
# grep lang /etc/yum.conf
override_install_langs=en_US
# export LANG=fr_FR
# ls foo
ls: cannot access foo: No such file or directory
My attempt at reinstalling glib-common before changing /etc/yum.conf
# yum -y -q reinstall glibc-common
Failed to set locale, defaulting to C
# ls foo
ls: cannot access foo: No such file or directory
# 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
POSIX
en_US
en_US.iso88591
en_US.iso885915
en_US.utf8
#
After changing /etc/yum.conf
to comment out the line override_install_langs=en_US
# vi /etc/yum.conf
# grep lang /etc/yum.conf
#override_install_langs=en_US
# yum -y -q reinstall glibc-common
Failed to set locale, defaulting to C
# ls foo
ls: cannot access foo: Aucun fichier ou dossier de ce type
# locale -a | wc -l
789
You need to reinstall the glibc-common
package. Here is the proof:
docker run -it --rm centos bash -c 'locale -a | wc -l && yum -y -q reinstall glibc-common && locale -a | wc -l'
53
789
Note: locale -a
lists installed locales, and wc -l
counts them, so those numbers are the number of locales before and after reinstalling glibc-common
.