我有一个简单的Dockerfile:
accommodation_id
并且无法构建。在最后一步,我得到bed_count
....
FROM ubuntu:18.04
RUN apt-get update
RUN apt-get install -y wget && rm -rf /var/lib/apt/lists/*
RUN wget \
https://repo.anaconda.com/miniconda/Miniconda3-latest-Linux-x86_64.sh \
&& mkdir /root/.conda \
&& bash Miniconda3-latest-Linux-x86_64.sh -b \
&& rm -f Miniconda3-latest-Linux-x86_64.sh \
&& echo PATH="/root/miniconda3/bin":$PATH >> .bashrc \
&& exec bash \
&& conda --version
RUN conda --version
的首次出现并没有引发错误,这使我怀疑是/bin/sh: 1: conda: not found
问题吗?
我想在此Dockerfile中再有一个conda --version
条目,在其中我将使用PATH
安装软件包
最后,我要输入RUN
,以便在执行此conda install ...
时,该图像会自动运行一个简单的python脚本,该脚本会导入随conda安装的所有库。也许还有一个CMD ["bash", "test.py"]
脚本,它将测试是否确实安装了conda和python解释器。
这是一个简化的示例,会有很多软件,所以我不想更改基本映像。
答案 0 :(得分:1)
这将可以使用ARG和ENV:
FROM ubuntu:18.04
ENV PATH="/root/miniconda3/bin:${PATH}"
ARG PATH="/root/miniconda3/bin:${PATH}"
RUN apt-get update
RUN apt-get install -y wget && rm -rf /var/lib/apt/lists/*
RUN wget \
https://repo.anaconda.com/miniconda/Miniconda3-latest-Linux-x86_64.sh \
&& mkdir /root/.conda \
&& bash Miniconda3-latest-Linux-x86_64.sh -b \
&& rm -f Miniconda3-latest-Linux-x86_64.sh \
RUN conda --version