5

I am trying to mount the current working directory onto Docker container but isn't working. Here is my 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"]

When i run the following to mount the current working directory to make sure everything is doing ok, what i see is that all those dependencies are getting installed in the current working directory.

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

I thought, they should only be installed on the container and only the output is going to generate in the current working directory. Sorry, i am very new to Docker and i would need some help with this....

upendra
  • 2,141
  • 9
  • 39
  • 64
  • I'm confused on what you are expecting. What are you expecting to happen? This sounds more dependent on how the application uses the current working directory. – Andy Shinn Dec 06 '15 at 22:36
  • By bind-mounting a directory into the container, you're explicitly giving the process in the container access to that directory on the host. The directory on the host and the directory inside the container are therefore *the same* directory; anything inside the container that writes to that directory, will thus effectively be writing to the directory on the host. – thaJeztah Dec 06 '15 at 23:05
  • If you want to "debug" the process to see if it works, you could consider using `docker exec -it bash` to open an interactive shell as a secondary process inside the container instead – thaJeztah Dec 06 '15 at 23:07

1 Answers1

3

Mouting a volume in docker (-v) allows a container to share directories/volumes with the host. Therefore when changing the volume you are in fact changing the mounted directory. If you wanted to copy some files, rather than point at them, you may need to build your own container and use the COPY or ADD instructions.

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

Community
  • 1
  • 1
cwharris
  • 17,835
  • 4
  • 44
  • 64