Dockerfile
FROM centos:7
LABEL maintainer="[email protected]"
LABEL description="centos7 & python3.8"
COPY ./Python-3.8.0.tgz ./Python-3.8.0.tgz
RUN set -ex \
&& yum update -y \
&& yum install -y wget tar libffi-devel zlib-devel bzip2-devel openssl-devel ncurses-devel sqlite-devel readline-devel tk-devel gcc make initscripts \
&& yum clean all \
&& tar -zxvf Python-3.8.0.tgz \
&& cd Python-3.8.0 \
&& ./configure prefix=/usr/local/python3 \
&& make \
&& make install \
&& make clean \
&& rm -rf /Python-3.8.0* \
&& yum install -y epel-release \
&& yum install -y python-pip
RUN set -ex \
&& mv /usr/bin/python /usr/bin/python27 \
&& mv /usr/bin/pip /usr/bin/pip-python2.7 \
&& ln -s /usr/local/python3/bin/python3.8 /usr/bin/python \
&& ln -s /usr/local/python3/bin/pip3 /usr/bin/pip
RUN set -ex \
&& sed -i "s#/usr/bin/python#/usr/bin/python2.7#" /usr/bin/yum \
&& sed -i "s#/usr/bin/python#/usr/bin/python2.7#" /usr/libexec/urlgrabber-ext-down \
&& yum install -y deltarpm
RUN set -ex \
&& rm -rf /etc/localtime \
&& ln -s /usr/share/zoneinfo/Asia/Shanghai /etc/localtime \
&& yum install -y vim \
&& yum -y install cronie
RUN yum install kde-l10n-Chinese -y
RUN localedef -c -f UTF-8 -i zh_CN zh_CN.utf8
RUN pip install -i https://pypi.tuna.tsinghua.edu.cn/simple --upgrade pip
ENV LC_ALL zh_CN.UTF-8
ENV TZ Asia/Shanghai
ENV PATH /usr/local/python3/bin/:$PATH
RUN ln -sf /usr/share/zoneinfo/Asia/ShangHai /etc/localtime
命令
docker bulid -t python3.8 .