Command error: `touch: .command.trace: Permission denied` when running on docker

Hi,

I have been trying to run several nf-core pipelines using docker and test profile in my local ubuntu machine.
I have docker-desktop installed and running.
I also added the user to the docker group. So I can run docker as non-root user.

For example: I run rnaseq pipeline with the command:

nextflow run nf-core/rnaseq -profile test,docker --outdir test_run -r 3.14.0

I am getting following error:

-[nf-core/rnaseq] Pipeline completed with errors-
ERROR ~ Error executing process > 'NFCORE_RNASEQ:RNASEQ:FASTQ_FASTQC_UMITOOLS_TRIMGALORE:TRIMGALORE (WT_REP2)'

Caused by:
  Process `NFCORE_RNASEQ:RNASEQ:FASTQ_FASTQC_UMITOOLS_TRIMGALORE:TRIMGALORE (WT_REP2)` terminated with an error exit status (1)

Command executed:

  [ ! -f  WT_REP2_1.fastq.gz ] && ln -s SRR6357072_1.fastq.gz WT_REP2_1.fastq.gz
  [ ! -f  WT_REP2_2.fastq.gz ] && ln -s SRR6357072_2.fastq.gz WT_REP2_2.fastq.gz
  trim_galore \
      --fastqc_args '-t 2' \
      --cores 1 \
      --paired \
      --gzip \
      WT_REP2_1.fastq.gz \
      WT_REP2_2.fastq.gz
  
  cat <<-END_VERSIONS > versions.yml
  "NFCORE_RNASEQ:RNASEQ:FASTQ_FASTQC_UMITOOLS_TRIMGALORE:TRIMGALORE":
      trimgalore: $(echo $(trim_galore --version 2>&1) | sed 's/^.*version //; s/Last.*$//')
      cutadapt: $(cutadapt --version)
  END_VERSIONS

Command exit status:
  1

Command output:
  (empty)

Command error:
  touch: .command.trace: Permission denied

Work dir:
  /home/arriyaz/temp/nextflow-practice/work/1d/f49845a12800d622ab339e74ab7172

Tip: view the complete command output by changing to the process work dir and entering the command `cat .command.out`

 -- Check './log/nextflow.log' file for details

Here is the log file:
nextflow.log (87.5 KB)

I am getting same error for other workflow also (e.g., mnaseseq, viralintegration)

Hello @arriyaz.

According to your nextflow.log file, you’re running Nextflow 23.10.1. I tried to simulate what you’re doing on macOS and on Linux with nextflow run nf-core/rnaseq -profile test,docker --outdir test_run -r 3.14.0. In both environments, the pipeline ran just fine. I attached a printscreen below showing FASTQ_FASTQC_UMITOOLS_TRIMGALORE:TRIMGALORE with WT_REP2 succeeded, differently from the same sample in your run that failed.

Based on that, I believe your problem is related to some Docker configuration and not Nextflow.

Hi, I have the same problem.
Are you able to solve it?

I run your workflow and demo workflow with simmilar errors. Have you figure out what could be the problem. I tried to run it in Debian and ubuntu, with docker rootless and with the normal docker without luck.

I send the .nextflow.log for:

nextflow run nf-core/demo -r dev -profile test,docker --outdir testDemo

nextflow.log (26,2 KB)

Hello @arriyaz and @Angel_Martinez-Perez,

Could you try providing a custom config file containing docker.fixOwnership = true?

In some docker containers the user is root and the files are created by root, this docker configuration will hopefully fix the ownership and will allow your user to modify these files.

This is because you modify /etc/subuid and /etc/subgid, and docker daemon configure userns-remap. Temporary close user namespace remapping by docker run --userns=host option.