How to configure locales to Unicode in a Docker Ubuntu 14.04 container?
I use this in my Dockerfile
:
# Set the locale
RUN locale-gen en_US.UTF-8
ENV LANG en_US.UTF-8
ENV LANGUAGE en_US:en
ENV LC_ALL en_US.UTF-8
One can also use the ENV
one-liner:
RUN locale-gen en_US.UTF-8
ENV LANG='en_US.UTF-8' LANGUAGE='en_US:en' LC_ALL='en_US.UTF-8'
The /etc/default/locale
file is loaded by PAM; see /etc/pam.d/login
for example. However, PAM is not invoked when running a command in a Docker container. To configure the locale, simply set the relevant environment variable in your Dockerfile. Example:
FROM ubuntu:trusty
ENV LANG en_US.UTF-8
CMD ["/bin/bash"]
Try
ENV LANG C.UTF-8
If you get the unsupported locale setting
error and don't want to install any new locales.