As a novice to the 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 need to create a docker container with two conda environments and then I want to call a command line from my native os (linux).
Firs i created two conda envs:
env-a.yml:
conda create --name env-a
conda activate env-a
conda install -c bioconda samtools
conda env export > env-a.yml
env-b.yml:
conda create --name env-b
conda activate env-b
conda install -c bioconda samtools
conda env export > env-b.yml
Next I build my docker container
Dockerfile:
FROM continuumio/miniconda3
COPY ./env-a.yml /opt/
COPY ./env-b.yml /opt/
RUN conda env create -f /opt/env-a.yml
RUN conda env create -f /opt/env-b.yml
RUN echo "source activate env-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
(env-a) root@1c44fcc2e83d:/#
looks good… now i want to mount a location from which my files are read and execute two pipelines each calling tools from different environment:
docker run --init -v /media/data/home/booby/test/:/opt/ test /bin/bash -c "source activate env-a && env view -h /opt/my.bam > /opt/my.sam && source activate env-b && samtools view -b /opt/my.sam > /opt/my.bam"
but when i mount a volume (-v) , it seams I lose access to my conda envs.
/bin/bash: activate: No such file or directory
what would be the proper way to set this up?
Thank you