Locale.Error with centos 7 based docker

I am new to docker and would appreciate if someone can help me get rid of this error while building the docker image.

Collecting pip
  Downloading pip-8.1.1-py2.py3-none-any.whl (1.2MB)
Collecting setuptools
  Downloading setuptools-20.3.1-py2.py3-none-any.whl (508kB)
Collecting wheel
  Downloading wheel-0.29.0-py2.py3-none-any.whl (66kB)
Installing collected packages: pip, setuptools, wheel
Successfully installed pip-8.1.1 setuptools-20.3.1 wheel-0.29.0
+ pip install --no-cache-dir --upgrade pip==8.0.2
Traceback (most recent call last):
  File "/usr/bin/pip", line 11, in <module>
    sys.exit(main())
  File "/usr/lib/python2.7/site-packages/pip/__init__.py", line 215, in main
    locale.setlocale(locale.LC_ALL, '')
  File "/usr/lib64/python2.7/locale.py", line 547, in setlocale
    return _setlocale(category, locale)
locale.Error: unsupported locale setting
The command '/bin/sh -c set -ex 	&& gpg --keyserver ha.pool.sks-keyservers.net --recv-keys "$GPG_KEY" 	&& curl -fSL 'https://bootstrap.pypa.io/get-pip.py' | python2 	&& pip install --no-cache-dir --upgrade pip==$PYTHON_PIP_VERSION' returned a non-zero code: 1

This is my Dockerfile:

FROM mybase:1.0.7

RUN set -x \
        && yum install -y python-devel libffi-devel python-cffi \
        && yum clean all

ENV LANG C.UTF-8

ENV GPG_KEY C01E1CAD5EA2C4F0B8E3571504C367C218ADD4FF

ENV PYTHON_VERSION 2.7.11

ENV PYTHON_PIP_VERSION 8.0.2

RUN set -ex \
        && gpg --keyserver ha.pool.sks-keyservers.net --recv-keys "$GPG_KEY" \
        && curl -fSL 'https://bootstrap.pypa.io/get-pip.py' | python2 \
        && pip install --no-cache-dir --upgrade pip==$PYTHON_PIP_VERSION

RUN pip install --no-cache-dir virtualenv

CMD ["python2"]

Please help me here, this is simply blocking me :frowning:

Shouldn’t get-pip.py always get the latest version? Why pin pip to a particular version?

At any rate, have you tried suggestions at http://stackoverflow.com/questions/25929604/pecl-python-unsupported-locale-setting-ubuntu-13-10 and http://stackoverflow.com/questions/14547631/python-locale-error-unsupported-locale-setting ? Seems it wants some variant of the following:

RUN apt-get install language-pack-en-base -y && \
         locale-gen en_US en_US.UTF-8 && \
         dpkg-reconfigure locale

(You might have to use ENV, not sure how Python locales work exactly.)