Search code examples
dockersnakemake

Snakemake: Docker image with all executables preinstalled


I would like to run Snakemake workflows from within a Docker container, i.e. the container itself should contain Snakemake, but also all required executables preinstalled. The executables are installed in various ways, from system package manager over downloadable binaries to Bioconda. Some Bioconda tools need to go into their own environment, because they are incompatible with the rest of the installation. But since Snakemake can't use preexisting environments, I'm left with either using conda directives (installation at runtime from within the Docker image?!) or container directives (Docker within Docker?!). Is there really no way for me to create a fully-fledged pre-built all-in-one image? Am I overlooking some best practices?

Thank you, Andreas


Solution

  • There's talk of adding the ability to specify conda environments by name, but it hasn't appeared yet:

    https://github.com/snakemake/snakemake/issues/352

    There are some options:

    • You can pre-build the environments with snakemake --conda-create-envs-only as part of the container build.

    • You can also (although its probably not best practice) activate an external environment as part of a rule's shell comand.