See all articles

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

iRonin IT Team

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`:

1 2 3 4 5 6 7 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

In Ubuntu, there is the `update-locale` tool which lets you do it quickly: (`update-locale en_US.UTF-8`)

Today’s Developers’ Notes were delivered by Łukasz, our Web Application Development Team Leader. Watch out for more useful tips in the future!

Bulletproof your development with remote team augmentation

Build your product and prevent possible issues with development process.