Repository navigation
Description
Summary
After #37/#38 fixed input staging, a containerized nf-core task now finds its inputs but fails to write its work dir:
ln: failed to create symbolic link 'SRR059377_stool_SRR059377_raw_1.gz': Permission denied
.command.sh: line 12: versions.yml: Permission denied
(FASTQC, exit 1.)
Two interacting causes in SpawnTaskHandler:
-
buildRunLineignores Nextflow'sdocker.runOptions. It emits a fixed argv:'docker run --rm -v "${LOCAL_DIR}":"${LOCAL_DIR}" -w "${LOCAL_DIR}" ' + image + ' bash .command.sh ...'
So a pipeline's
docker { runOptions = '--user root' }(and any other run options) is silently dropped. The container therefore runs as the image's default user — which for biocontainers/nf-core images is typically a non-root user. -
The work dir is root-owned.
buildStagingScriptdoessudo mkdir -p "${LOCAL_DIR}" && sudo chown "$(id -u):$(id -g)" "${LOCAL_DIR}"— and the staging script runs as root (EC2 user-data), soid -uis 0 →/var/lib/nf-workis owned by root. The staged input files (aws s3 cp, also root) are root-owned too.
Net: a non-root container process is -w'd into a root-owned dir and can't create the symlinks .command.sh makes, nor write versions.yml. Every stock module that symlinks inputs or writes outputs into the task dir hits this.
Note the only process that works is one that sets its container user itself or runs tooling as root inside its own script — i.e. the same self-help pattern that masked #37.
Repro
nf-spawn 0.2.9, Nextflow 26.04.x, AL2023 arm64, workDir = s3://…, a process with a container directive and docker { runOptions = '--user root' } in config (e.g. nf-core/taxprofiler FASTQC). Input staging succeeds (#38); the task fails at the first write with Permission denied.
Suggested fix (either, or both)
- Honor
docker.runOptions(and ideally the otherdocker {}scope settings) inbuildRunLine, e.g. splicetask.config.getContainerOptions()/ the session'sdocker.runOptionsinto thedocker runargv. That alone fixes the reported case (--user root→ container is root → can write the root-owned dir). - Make the work dir writable by the container user regardless — e.g.
chmod 0777 "${LOCAL_DIR}"after staging (or run the container with--user $(id -u):$(id -g)and own the dir to that uid). Belt-and-suspenders for images whose default user is non-root and pipelines that don't set--user root.
(1) restores expected Nextflow semantics; (2) avoids surprising users who rely on the image's default user. Doing both is probably ideal.
Context
Found validating #38 against the aws-microbiome-demo taxprofiler pipeline (the #37 reporter). Good news in the same run: #38's input staging works (FASTQC now finds its reads), and the native arm64 container pulled and ran fine — this permissions gap is the next thing in the way. Happy to test a fix; same one-line plugin-version bump on my side.
- Observed 2026-06-13. nf-spawn 0.2.9.
Activity
fix: honor docker.runOptions and make work dir writable (#39) (#40)
scttfrdmn commentedon Jun 13, 2026
Fixed and released in v0.2.10 (#40) — ZIP is live: https://github.com/spore-host/nf-spawn/releases/tag/v0.2.10
Did both halves you recommended:
resolveDockerRunOptions(task)collects bothdocker.runOptions(engine scope, from the task'sContainerConfig) and the per-processcontainerOptionsdirective, andbuildRunLinenow splices them verbatim before the image — so--user root(or anything else you set) is applied.chmod 0777s the work dir before the container runs, so even a non-root image user can write its outputs into the bind-mounted dir.Both are best-effort/null-safe: if options can't be resolved, the task just runs with none (prior behavior) rather than aborting.
To re-validate: bump your
TARGET_NF_SPAWN_VERSIONto0.2.10. This should clear thePermission deniedyou hit on FASTQC. If that unblocks it, the remaining open thread is the.gzrename caveat from #37 — let me know if it still bites once the run completes end-to-end.