1

I have set following locale settings in my Dockerfile:

# Set the russian locale
RUN apt-get clean && apt-get update && apt-get install -y locales
RUN locale-gen ru_RU.UTF-8
ENV LANG ru_RU.UTF-8
ENV LANGUAGE ru_RU.UTF-8
ENV LC_ALL ru_RU.UTF-8

It seems that locale does not set correctly:

root@4fcfdd39679c:/front-office# locale 
locale: Cannot set LC_CTYPE to default locale: No such file or directory
locale: Cannot set LC_MESSAGES to default locale: No such file or directory
locale: Cannot set LC_ALL to default locale: No such file or directory
LANG=ru_RU.UTF-8
LANGUAGE=ru_RU.UTF-8
LC_CTYPE="ru_RU.UTF-8"
LC_NUMERIC="ru_RU.UTF-8"
LC_TIME="ru_RU.UTF-8"
LC_COLLATE="ru_RU.UTF-8"
LC_MONETARY="ru_RU.UTF-8"
LC_MESSAGES="ru_RU.UTF-8"
LC_PAPER="ru_RU.UTF-8"
LC_NAME="ru_RU.UTF-8"
LC_ADDRESS="ru_RU.UTF-8"
LC_TELEPHONE="ru_RU.UTF-8"
LC_MEASUREMENT="ru_RU.UTF-8"
LC_IDENTIFICATION="ru_RU.UTF-8"
LC_ALL=ru_RU.UTF-8
root@4fcfdd39679c:/front-office#

but when i write text in bash (running like this: docker-compose run --rm app bash), there is malformed cyrillic text - it starts with char ":�" and not fully supported all russian letters. How to solve it?

3
  • 1
    Note: this error is often not on the image, but on the terminal which should show the text. Do you have a good font? The locale on the viewing computer is set correctly? And the TERM? Commented Feb 26, 2019 at 15:15
  • I`m not sure. How I can check the font and TERM? Commented Feb 27, 2019 at 8:09
  • 1
    Where you run docker. For me the problem is on your "computer" side (not inside docker). Check that your terminal support Unicode and that TERM environmanr variable (also inside docker) is compatible with the setting of your terminal. Commented Feb 27, 2019 at 8:29

1 Answer 1

4

I added follow code to Dockerfile and rebuilded image. All works well

RUN apt-get update && apt-get install -y locales

# Locale
RUN sed -i -e \
  's/# ru_RU.UTF-8 UTF-8/ru_RU.UTF-8 UTF-8/' /etc/locale.gen \
   && locale-gen

ENV LANG ru_RU.UTF-8
ENV LANGUAGE ru_RU:ru
ENV LC_LANG ru_RU.UTF-8
ENV LC_ALL ru_RU.UTF-8

Link to original answer on StackOverflow.ru

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.