Docker Python set utf-8 locale

后端 未结 4 1075
星月不相逢
星月不相逢 2020-12-10 13:00

I am trying to run my python file that first reads a string in Chinese language and print it.

This is my Dockerfile

FROM python:2.7-onbuild
ENV LANG          


        
4条回答
  •  遥遥无期
    2020-12-10 13:30

    I add the below command in my docker file:

    RUN locale-gen en_US.UTF-8
    ENV LANG='en_US.UTF-8' LANGUAGE='en_US:en' LC_ALL='en_US.UTF-8'
    

    then build/rebuild docker images, you'd better add this in the base image.

提交回复
热议问题