Running Nextflow entirely from Docker containers

Apologies if these are beginner questions for Nextflow. I am trying to configure Nextflow (Cutandrun in particular) to run on my local cluster, but unfortunately Java is not available as a module, so I cannot use Nextflow directly on it. They do offer Singularity, so I’m trying to start out with Docker and figure out how to get Nextflow to work entirely from containers. So far, I have been able to fetch both the nextflow/nextflow and the nfcore/tools containers from dockerhub and run them successfully, but I am unable to successfully run a pipeline. For example I start the Cutanrun pipeline using this command (on a PC, WSL2 Ubuntu):

docker run -itv “/home/jcreamer”:“/home/jcreamer/” nextflow/nextflow:latest nextflow run nf-core/cutandrun -r 3.2.2 -profile docker --input /home/jcreamer/test.csv --genome GRCh38 --outdir /home/jcreamer/test_1

Nextflow initiates, and starts the pipeline, but it fails after this error:

ERROR ~ Error executing process > ‘NFCORE_CUTANDRUN:CUTANDRUN:INPUT_CHECK:SAMPLESHEET_CHECK (test.csv)’

Caused by:
Process NFCORE_CUTANDRUN:CUTANDRUN:INPUT_CHECK:SAMPLESHEET_CHECK (test.csv) terminated with an error exit status (125)

Command executed:

check_samplesheet.py test.csv samplesheet.valid.csv true

cat <<-END_VERSIONS > versions.yml
“NFCORE_CUTANDRUN:CUTANDRUN:INPUT_CHECK:SAMPLESHEET_CHECK”:
python: $(python --version | grep -E -o “([0-9]{1,}.)+[0-9]{1,}”)
END_VERSIONS

Command exit status:
125

Command output:
(empty)

Command error:
docker: Cannot connect to the Docker daemon at unix:///var/run/docker.sock. Is the docker daemon running?.
See ‘docker run --help’.

Work dir:
/work/84/1730c9b57b7a2ba7bff69fb42b75e3

Tip: you can replicate the issue by changing to the process work dir and entering the command bash .command.run

– Check ‘.nextflow.log’ file for detail

It seems like the initial container cannot call docker further, how do I direct the container to use the existing docker installation on the machine? Does Singularity fix these issues? There’s no clear cut instructions for how to accomplish a pure containerized Nexftlow from what I’ve found. Also, using the “conda” profile does not fix it, instead I get an issue that says “conda” cannot be found. Is there a container source that has ALL the dependencies required for nextflow/nf-core that runs out of the gate? How would I go about constructing this if nextflow running inside the container requires further container calls to complete a pipeline?

I suggest installing Nextflow with Pixi [Home], which is like a successor to Conda/Mamba. Then use run the processes using Singularity. The singularity profile might be enough, which without other profiles, will run all the processes on the node you invoked Nextflow. Ideally, you should first check if nf-core has an institutional profile for your cluster (nf-core/configs), otherwise write one which enables interacting with your job submission system if you have one ( e.g. slurm, lsf ), and singularity.

Docker and Singularity are generally isolated, so cannot interact with tools outside the container without extensive configuration. Pixi/Conda/Mamba, on the other hand, are not isolated and allow interaction with existing system tools as well as the environment you created.

@mahesh.binzerpanchal Thank you for your help! Does Pixi obviate the need for Nextflow to use Java? I can run a container on our cluster with Java, but Java isn’t callable on the compute node. Is it possible to install Java without super user privileges? I took a look at the configs and unfortunately our cluster does not have an institutional profile. My plan was to use the slurm scheduler to lease a compute node to run a container with everything Nextflow needs within it, but if I can run Pixi/Conda/Mamba with a local/non-super user Java to then call Singularity for all the workflow steps, that might work also.

Yes, it’ll install all dependencies necessary for Nextflow as listed on bioconda.

pixi init -c conda-forge -c bioconda
pixi add nextflow
pixi run nextflow run nf-core/demo -profile test,singularity

Then you can write a custom profile to get it running on both slurm and singularity together.

1 Like

Awesome, I’ll give it a shot and report back, thanks!