我为Plink和Peddy制作了以下Docker容器,但是每当尝试构建该容器时,都会出现以下错误:
Executing transaction: ...working... WARNING conda.core.envs_manager:register_env(46): Unable to register environment. Path not writable or missing.
environment location: /root/identity_check/anaconda
registry file: /root/.conda/environments.txt
done
installation finished.
Removing intermediate container cdf60f5bf1a5
---> be254b7571be
Step 7/10 : RUN conda update -y conda && conda config --add channels bioconda && conda install -y peddy
---> Running in aa2e91da28b4
/bin/sh: 1: conda: not found
The command '/bin/sh -c conda update -y conda && conda config --add channels bioconda && conda install -y peddy' returned a non-zero code: 127
Dockerfile:
FROM ubuntu:19.04
WORKDIR /identity_check
RUN apt-get update && \
apt-get install -y \
python-pip \
tabix \
wget \
unzip
RUN apt-get update && apt-get install -y sudo && rm -rf /var/lib/apt/lists/* \
&& sudo apt-get -y update \
&& sudo pip install --upgrade pip \
&& sudo pip install awscli --upgrade --user \
&& sudo pip install boto3 \
&& sudo pip install pyyaml \
&& sudo pip install sqlitedict
# Install PLINK
RUN wget http://s3.amazonaws.com/plink1-assets/plink_linux_x86_64_20190617.zip \
&& mv plink_linux_x86_64_20190617.zip /usr/local/bin/ \
&& unzip /usr/local/bin/plink_linux_x86_64_20190617.zip
# Install Peddy
RUN INSTALL_PATH=~/anaconda \
&& wget http://repo.continuum.io/miniconda/Miniconda2-latest-Linux-x86_64.sh \
&& bash Miniconda2-latest* -fbp $INSTALL_PATH \
&& PATH=$INSTALL_PATH/bin:$PATH
RUN conda update -y conda \
&& conda config --add channels bioconda \
&& conda install -y peddy
ENV PATH=$PATH:/identity_check/
ADD . /identity_check
CMD bash /identity_check/identity_setup.sh
我尝试更改INSTALL_PATH
并查看是否有所作为,甚至启动了虚拟机来手动测试这些安装步骤,并且运行良好。我不明白为什么找不到conda。
答案 0 :(得分:0)
# Install Peddy
RUN INSTALL_PATH=~/anaconda \
&& wget http://repo.continuum.io/miniconda/Miniconda2-latest-Linux-x86_64.sh \
&& bash Miniconda2-latest* -fbp $INSTALL_PATH \
&& PATH=$INSTALL_PATH/bin:$PATH
上面的最后一部分更新了PATH
变量,该变量仅存在于运行命令的shell中。设置PATH变量后,该外壳程序立即退出,并且用于执行RUN
命令的临时容器退出。 RUN
命令的结果是将文件系统更改收集到正在创建的docker映像的一层中。任何环境变量更改,启动的后台进程或不属于容器文件系统的任何其他内容都会丢失。
相反,您需要使用以下命令更新图像环境:
# Install Peddy
RUN INSTALL_PATH=~/anaconda \
&& wget http://repo.continuum.io/miniconda/Miniconda2-latest-Linux-x86_64.sh \
&& bash Miniconda2-latest* -fbp $INSTALL_PATH \
ENV PATH=/root/anaconda/bin:$PATH
如果软件允许,我将避免安装在/root
主目录中,而是将其安装在/usr/local/bin
之类的位置,如果将容器更改为以其他用户身份运行,则可以使用它。 / p>