构建Docker映像时安装Anaconda和软件包

时间:2019-11-13 14:52:45

标签: linux bash docker anaconda

我希望在构建 miniconda映像时安装conda并安装docker软件包。我使用以下命令安装miniconda

FROM nvidia/cuda:10.1-cudnn7-devel-ubuntu18.04
RUN wget --quiet https://repo.anaconda.com/miniconda/Miniconda2-4.5.11-Linux-x86_64.sh -O ~/miniconda.sh && \
/bin/bash ~/miniconda.sh -b -p /opt/conda && \
rm ~/miniconda.sh && \
ln -s /opt/conda/etc/profile.d/conda.sh /etc/profile.d/conda.sh && \
echo ". /opt/conda/etc/profile.d/conda.sh" >> ~/.bashrc && \
echo "conda activate" >> ~/.bashrc

然后我尝试使用以下方法安装conda软件包:

RUN conda install numpy

我收到以下错误:

/bin/sh: 1: conda: not found
The command '/bin/sh -c conda' returned a non-zero code: 127

非常感谢您的协助。

1 个答案:

答案 0 :(得分:0)

按照stephanmg的建议,我使用以下命令将conda添加到了PATH,现在可以找到conda

ENV PATH="/opt/conda/bin:${PATH}"
RUN conda