dockerfile 安装 conda

该博客介绍了如何在CentOS Docker镜像中安装Miniconda,创建Python 3.6的环境,并安装Jupyter。通过设置环境变量和配置文件,确保conda命令可用,并添加了清华大学的Anaconda镜像源以加速包的下载。最后,激活Python环境并安装numpy, pandas, jupyter和scikit-learn等数据科学库。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

首先下载好 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"]

在centos的docker里安装jupyter并开放端口

评论 2
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

颹蕭蕭

白嫖?

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值