1

I am running a Nextflow pipeline that runs each process in a different Docker container. I run this pipeline inside a VM. While some of the processes work fine, in one of them I get an error:

java.io.FileNotFoundException: file_fastqc.zip (Permission denied)
Approxat java.base/java.io.FileOutputStream.open0(Native Method)
Approxat java.base/java.io.FileOutputStream.open(FileOutputStream.java:298)
Approxat java.base/java.io.FileOutputStream.<init>(FileOutputStream.java:237)
Failedat java.base/java.io.FileOutputStream.<init>(FileOutputStream.java:187)
java.iat uk.ac.babraham.FastQC.Report.HTMLReportArchive.<init>(HTMLReportArchive.java:80)
  at uk.ac.babraham.FastQC.Analysis.OfflineRunner.analysisComplete(OfflineRunner.java:178)
  at uk.ac.babraham.FastQC.Analysis.AnalysisRunner.run(AnalysisRunner.java:110)
  at java.base/java.lang.Thread.run(Thread.java:834)

The docker container that I am using in this process is biocontainers/fastqc:v0.11.8dfsg-2-deb_cv1

I am Running nextflow as sudo and I have tried to change execution folder permissions, but the error persists.

I have also tried to use the option docker.fixOwnership = true in Nextflow and a similar error appears

cannot touch '.command.trace': Permission denied

Running the same pipeline in my personal computer with the same Docker container and Nextflow (19.10) and Java (11) versions and it works perfectly fine.

Any help on how to solve this problem would be really appreciated.

Julia
  • 21
  • 1
  • 5
  • You have to give permissions for the java process. The process is probably not run in root. `chown : file_fastqc.zip` in the Dockerfile may solve it. – samthegolden Jan 17 '20 at 17:45
  • Following all the steps in "Manage Docker as non-root user" from Docker documentation https://docs.docker.com/install/linux/linux-postinstall/ solved the problem. – Julia Jan 20 '20 at 15:31
  • Then answer your own question for other people to know. – samthegolden Jan 20 '20 at 16:15

2 Answers2

0

The solution that worked for me was to enable the use of Docker as a non-root user as described in Docker documentation: docs.docker.com/install/linux/linux-postinstall

Julia
  • 21
  • 1
  • 5
0

When you use a non-root docker in nextflow you need to give permissions to write inside the working directory to the docker non-root user. I solved this by adding beforeScript 'chmod o+rw .' like in this example:

process myproc{
  input: 
  file(infile) from ch_infile
  output:
  file("outfile.txt") into ch_outfile

  container 'centos:7'
  beforeScript 'chmod o+rw .'
  """
  # ... do something here... 
  head ${infile} > outfile.txt
  """

}

I solved it thanks to this: https://github.com/InformaticsMatters/pipelines/issues/22

rgiannico
  • 33
  • 6