As a novice to this community (and technology) I have only a basic knowledge regarding how to build and deploy a docker so i was hoping someone could provide some help.
The situation is the following:
I wanna create a docker container with two conda environments and I wanna call a command line from my native os cmd.
my Dockerfile:
FROM continuumio/miniconda3
COPY ./samtools-a.yml /opt/
COPY ./samtools-b.yml /opt/
RUN conda env create -f /opt/samtools-a.yml
RUN conda env create -f /opt/samtools-b.yml
RUN echo "source activate samtools-a" > ~/.bashrc
ENV PATH /opt/conda/envs/env/bin:$PATH
my build :
docker build -t test ./
and now i run it
docker run -it test
(samtools-a) root@1c44fcc2e83d:/#
looks good… but now i would like to mount a location from which my files are read and excute two commandlines each in different environment. my reasoning was that this should have done it :
docker run --init -v /media/data/home/booby/test/:/opt/ test /bin/bash -c "source activate samtools-a && samtools view -h /opt/my.bam > /opt/my.sam && source activate samtools-b && samtools view -b /opt/my.sam > /opt/my.bam"
but when i use -v , i seam to lose access to my conda env.
/bin/bash: activate: No such file or directory
what would be the proper way to set this up
PS
I created samtools env like this :
conda create --name samtools-a
conda activate samtools-a
conda install -c bioconda samtools
conda env export > samtools-a.yml
conda create --name samtools-b
conda activate samtools-b
conda install -c bioconda samtools
conda env export > samtools-b.yml
Thank you