Issue with Dockerfile, Centos and Flask

Hello, I have the following Dockerfile:

FROM centos:centos7.9.2009
RUN yum update -y
RUN yum install -y python
RUN yum install -y python3-pip
RUN pip3 install flask
COPY /opt/
ENTRYPOINT FLASK_APP=/opt/ flask run --host=

When I run “docker build . -t test123” it finishes successfully

But when I run “docker run test123” it fails with the following:

Traceback (most recent call last):
  File "/usr/local/bin/flask", line 11, in <module>
  File "/usr/local/lib64/python3.6/site-packages/flask/", line 995, in main
  File "/usr/local/lib64/python3.6/site-packages/flask/", line 601, in main
    return super().main(*args, **kwargs)
  File "/usr/local/lib/python3.6/site-packages/click/", line 1034, in main
  File "/usr/local/lib/python3.6/site-packages/click/", line 100, in _verify_python_env
    raise RuntimeError("\n\n".join(extra))
RuntimeError: Click will abort further execution because Python was configured to use ASCII as encoding for the environment. Consult for mitigation steps.

This system lists some UTF-8 supporting locales that you can pick from. The following suitable locales were discovered: en_US.utf8

Tried to add to Dockerfile, did not help

RUN export LC_CTYPE=en_US.UTF-8
RUN export LC_ALL=en_US.UTF-8

Please suggest, how this situation can be fixed?

I think there should be a
RUN yum install -y epel-release
RUN yum install -y python3 python3-pip
RUN pip3 install flask


I have been facing the same issue tried both options of setting env and also adding “RUN yum install -y epel-release” but still no luck.

Could anyone resolve the issue?

Thank you,


Just setting the env to proper location has resolved the issue, I was setting it up as “en_IN.UTF-8”, but the server time zone was “en_US.UTF8”, and also for env settting instead of “RUN” use “ENV” to set env variable.

ENV export LC_CTYPE=en_US.UTF-8
ENV export LC_ALL=en_US.UTF-8

Thank you,