When I try "docker run -p 8050:8050 app1" in docker I get:
Traceback (most recent call last):
File "app1.py", line 6, in <module>
locale.setlocale(locale.LC_ALL, 'en_US.UTF-8')
File "/usr/local/lib/python3.6/locale.py", line 598, in setlocale
return _setlocale(category, locale)
My dockerfile looks like this:
FROM python:3.6
USER root
WORKDIR /app
ADD . /app
RUN apt-get update && apt-get -y install locales
RUN locale-gen en_US.UTF-8
ENV LANG en_US.UTF-8
ENV LANGUAGE en_US:en
ENV LC_ALL en_US.UTF-8
RUN pip install --trusted-host pypi.python.org -r requirements.txt
EXPOSE 8050
ENV NAME World
CMD ["python", "app1.py"]
How can i set a local language in the app1.py without getting this error? thanks in advance
PS: Already restarted docker.
That worked for me
RUN apt-get install -y locales
RUN sed -i -e 's/# en_US.UTF-8 UTF-8/en_US.UTF-8 UTF-8/' /etc/locale.gen \
&& sed -i -e 's/# pt_BR.UTF-8 UTF-8/pt_BR.UTF-8 UTF-8/' /etc/locale.gen \
&& locale-gen
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With