Search code examples
ubuntudockerdebianlocaledockerfile

Generate all locales in a docker image


How can one generate all locales in a debian/ubuntu based docker image?

locale-gen doesn't accept the -A/--all option as described here: http://www.linuxhowtos.org/manpages/8/locale-gen.htm.

dpkg-reconfigure locales has an option to generate all locales in the interactive mode, but this is not available in a Dockerfile.

Just generating English or a fixed set of languages isn't enough and doesn't sound correct.


Solution

  • In /etc/locale.gen I've found the hint, that /usr/share/i18n/SUPPORTED lists all supported locale codes. As of https://people.debian.org/~schultmc/locales.html and https://wiki.debian.org/Locale it should be enough to add all wanted codes to /etc/locale.gen and run locale-gen. So this is my solution:

    RUN cp /usr/share/i18n/SUPPORTED /etc/locale.gen
    RUN locale-gen