FROM centos:7
#安装网络下载wget包,并从镜像下载Centos-7.repo 和epel-7.repo
RUN yum -y install make wget \
&& wget -O /etc/yum.repos.d/CentOS-Base.repo http://mirrors.aliyun.com/repo/Centos-7.repo \
&& wget -P /etc/yum.repos.d/ http://mirrors.aliyun.com/repo/epel-7.repo \
&& yum clean all && yum makecache
#下载安装centos一些基础包,如解压
RUN yum -y install zlib-devel bzip2-devel openssl-devel ncurses-devel sqlite-devel readline-devel tk-devel gcc
#下载python,解压、编译、安装
RUN wget -O /usr/local/src/Python-3.5.5.tar.xz https://www.python.org/ftp/python/3.5.5/Python-3.5.5.tar.xz \
&& cd /usr/local/src/ && xz -d Python-3.5.5.tar.xz && tar -xf Python-3.5.5.tar \
&& cd /usr/local/src/Python-3.5.5 && ./configure prefix=/usr/local/python3 && make && make install
RUN mv /usr/bin/python /usr/bin/python.bak \
&& ln -s /usr/local/python3/bin/python3.5 /usr/bin/python && rm -rf /usr/bin/pip* \
&& ln -s /usr/local/python3/bin/pip3 /usr/bin/pip3 \
&& ln -s /usr/bin/pip3 /usr/bin/pip
#解决python依赖问题
RUN sed -i 's@/usr/bin/python@/usr/bin/python2@' /usr/bin/yum \
&& sed -i 's@/usr/bin/python@/usr/bin/python2@' /usr/libexec/urlgrabber-ext-down
#安装tensorflow
RUN pip3 install -i https://pypi.tuna.tsinghua.edu.cn/simple tensorflow==1.11.0 \
&& pip3 install -i https://pypi.tuna.tsinghua.edu.cn/simple Keras==2.2.4
dockfile Cenos7 cpu版本
最新推荐文章于 2024-04-12 04:57:05 发布