如何将当前工作目录挂载到Docker容器?

时间:2015-12-06 20:22:48

标签: docker

我正在尝试将当前工作目录挂载到Docker容器上但是没有工作。这是我的Dockerfile

FROM ubuntu:14.04.3
MAINTAINER Upendra Devisetty

RUN apt-get update && apt-get install -y g++ \
                make \
                git \
                zlib1g-dev \
                python \
                wget \
                curl \
                python-matplotlib

ENV BINPATH /usr/bin
ENV HISAT2GIT https://upendra_35@bitbucket.org/upendra_35/evolinc.git

RUN git clone "$HISAT2GIT"
RUN chmod +x evolinc/evolinc-part-I.sh && cp evolinc/evolinc-part-I.sh $BINPATH
RUN wget -O- http://cole-trapnell-lab.github.io/cufflinks/assets/downloads/cufflinks-2.2.1.Linux_x86_64.tar.gz | tar xzvf -
RUN wget -O- https://github.com/TransDecoder/TransDecoder/archive/2.0.1.tar.gz | tar xzvf -
RUN wget -O- http://seq.cs.iastate.edu/CAP3/cap3.linux.x86_64.tar | tar vfx -
RUN curl ftp://ftp.ncbi.nlm.nih.gov/blast/executables/blast+/LATEST/ncbi-blast-2.2.31+-x64-linux.tar.gz > ncbi-blast-2.2.31+-x64-linux.tar.gz
RUN tar xvf ncbi-blast-2.2.31+-x64-linux.tar.gz
RUN wget -O- http://ftp.mirrorservice.org/sites/download.sourceforge.net/pub/sourceforge/q/qu/quast/quast-3.0.tar.gz | tar zxvf -
RUN curl -L http://cpanmin.us | perl - App::cpanminus
RUN cpanm URI/Escape.pm

ENV PATH /CAP3/:$PATH
ENV PATH /ncbi-blast-2.2.31+/bin/:$PATH
ENV PATH /quast-3.0/:$PATH
ENV PATH /cufflinks-2.2.1.Linux_x86_64/:$PATH
ENV PATH /TransDecoder-2.0.1/:$PATH
ENTRYPOINT ["/usr/bin/evolinc-part-I.sh"]
CMD ["-h"]

当我运行以下命令来安装当前工作目录以确保一切正常时,我看到所有这些依赖项都安装在当前工作目录中。

docker run --rm -v $(pwd):/working-dir -w /working-dir ubuntu/evolinc:2.0 -c cuffcompare_out_annot_no_annot.combined.gtf -g Brassica_rapa_v1.2_genome.fa -r Brassica_rapa_v1.2_cds.fa -b TE_RNA_transcripts.fa

我想,它们只应安装在容器上,并且只在当前工作目录中生成输出。对不起,我对Docker很新,我需要一些帮助......

1 个答案:

答案 0 :(得分:3)

在docker(gsl_block*)中设置卷允许容器与主机共享目录/卷。因此,在更改卷时,您实际上正在更改已安装的目录。如果您想复制某些文件,而不是指向,则可能需要构建自己的容器并使用-vCOPY指令。

What is the difference between the `COPY` and `ADD` commands in a Dockerfile?