首先下载好 Miniconda3-latest-Linux-x86_64.sh 和 centos docker镜像
$ docker pull centos:7
$ wget https://mirrors.tuna.tsinghua.edu.cn/anaconda/miniconda/Miniconda3-latest-Linux-x86_64.sh
$ ls
Dockerfile Miniconda3-latest-Linux-x86_64.sh
Dockerfile 内容如下:
FROM centos:7
MAINTAINER itnerd@blog.csdn.com
COPY . /root
ENV PATH /opt/conda/bin:$PATH
RUN cd /root \
&& sh Miniconda3-latest-Linux-x86_64.sh -b -p /opt/conda \
&& rm -f Miniconda3-latest-Linux-x86_64.sh \
&& ln -s /opt/conda/etc/profile.d/conda.sh /etc/profile.d/conda.sh \
&& echo ". /opt/conda/etc/profile.d/conda.sh" >> ~/.bashrc \
&& source /root/.bashrc \
&& conda config --add channels https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/free/ \
&& conda config --add channels https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/main/ \
&& conda config --set show_channel_urls yes \
&& conda create -n py36 python=3.6 -y \
&& conda activate py36 \
&& conda install numpy pandas jupyter scikit-learn
CMD ["/bin/bash"]