Minimally Reproducible Conda Set Up For Nextflow

I had a bit of difficulty installing conda via a Dockerfile that would be friendly to Nextflow. Got to these run commands that worked for me:

# Install Miniconda
RUN curl -O https://repo.anaconda.com/miniconda/Miniconda3-latest-Linux-x86_64.sh && \
    bash Miniconda3-latest-Linux-x86_64.sh -b -p /opt/conda && \
    rm Miniconda3-latest-Linux-x86_64.sh

# Add conda to PATH
ENV PATH="/opt/conda/bin:${PATH}"

RUN conda init bash

I would also suggest looking at Seqera Containers before trying to make a custom container with Conda ( and not to mention all the business with conda defaults channel licensing ).

Seqera Containers can build custom images for docker and singularity from conda-forge, bioconda, and pypi using micromamba.

E.g. Wave container build notification

If you’re having trouble using the Seqera Containers interface, you can also use the wave cli and build a container that way for example with:

./wave-1.4.1-linux-x86_64 --freeze --conda-file env.yml

The --freeze pushes the container to the community registry, and you might be able to use other channels in this way too. The command-line wave interface is also much more powerful and worth exploring.

2 Likes