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

iRonin IT Team - Experts in software development
developers notes, docker

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

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!

Author's Bio
iRonin IT Team

Experts in software development

We are a 100% remote team of software development experts, providing web & mobile application development and DevOps services for international clients.

Similar articles

Bulletproof your development with remote team augmentation

Read how
This page is best viewed in portrait mode
Our websites and web services use cookies. We use cookies and collected data to enhance your experience, provide additional communication channels, improve marketing materials and enhance our offer. IRONIN SP. Z O.O. SP. K. is committed to protecting all the data that we collect or process in any way, especially data of personal nature. By accepting these terms you agree to our usage of cookies and processing your data, according to our Privacy Policy, and you declare that your browser settings reflect your preferences. Read more You have the right to revoke this agreement at any time, based on the terms of our Privacy Policy. You can change cookies settings in your browser. If you do not agree with us using cookies and processing your data, please change your cookies settings in your web browser and reject these terms. You can find more information about cookies, your data privacy This site uses cookies. By continuing to browse the site, you are agreeing to our use of cookies. data processing, and your rights in our Privacy Policy.