Docker Debian based image does not have default locale set - Developers’ Notes

Here’s an easy fix for when Docker and the sablon gem don’t want to cooperate: just update your locale.
A problem with the sablon gem occured when our team was developing an application locally in a Docker container. The Docker image based on Debian Jessie didn't have locale set which caused an encoding issue in sablon.
We updated our Dockerfile with the following lines to make sure locale is correctly set to utf-8:
RUN sed -i -e 's/# en_US.UTF-8 UTF-8/en_US.UTF-8 UTF-8/' /etc/locale.gen && \
echo 'LANG="en_US.UTF-8"'>/etc/default/locale && \
dpkg-reconfigure --frontend=noninteractive locales && \
update-locale LANG=en_US.UTF-8
ENV LANG en_US.UTF-8
ENV LANG en_US.UTF-8
ENV LANGUAGE en_US.UTF-8
ENV LC_ALL en_US.UTF-8