Reputation: 356
I have made a programming model in python 2.7 version and want to run it on Centos 6.8 version by using it in a Docker File.
At present there is two version of python in my Docker File:
But when I start to install the libraries by using pip it gets installed in the python 2.6 version
I want to make a Docker file such that a person doesn't need to manually go into the container and create a system link to use it.
It should be all included in the Docker file itself. Is there anyone who can give me a clear idea how this is possible in Centos 6 only.
Upvotes: 0
Views: 4924
Reputation: 407
You want to install python 2.7 inside the Dockerfile ?
FROM centos:6.8
RUN yum -y update
RUN yum install -y epel-release && yum groupinstall -y 'development tools'
RUN yum install -y zlib-dev openssl-devel sqlite-devel bzip2-devel xz-libs wget
RUN wget https://www.python.org/ftp/python/2.7.8/Python-2.7.8.tar.xz
RUN tar xvfJ Python-2.7.8.tar.xz
WORKDIR Python-2.7.8
RUN ./configure --prefix=/usr/local && make && make altinstall
RUN curl https://bootstrap.pypa.io/get-pip.py | python2.7
Inside this container the version 2.6.6 still as default, to use python 2.7.8 you have to specify explicitly python2.7
:
[root@79f3f51d0000 ~]# which python
/usr/bin/python
[root@79f3f51d0000 ~]# which python2.7
/usr/local/bin/python2.7
[root@79f3f51d0000 ~]# which pip2.7
/usr/local/bin/pip2.7
Upvotes: 2