Skip to content

fix: honor docker.runOptions and make work dir writable (#39) - #40

Merged
scttfrdmn merged 1 commit into
mainfrom
fix/39-honor-runoptions-writable-workdir
Jun 13, 2026
Merged

scttfrdmn merged 1 commit into
mainfrom
fix/39-honor-runoptions-writable-workdir

Conversation

@scttfrdmn

Copy link
Copy Markdown
Collaborator

Closes #39.

Problem

The filer validated #37/#38 (input staging) works — but hit a new blocker:
containerized tasks ignored docker.runOptions (and the per-process
containerOptions directive), so the container ran as the image's default
(non-root) user. Combined with a root-owned bind-mounted work dir, the
container user couldn't write its outputs and the task failed with
Permission denied.

Fix (both halves the filer recommended)

  1. Honor run options. New resolveDockerRunOptions(task) gathers
    docker.runOptions (from the task's ContainerConfig) and
    containerOptions, and buildRunLine splices them verbatim before the
    image — so --user root (and anything else) is applied.
  2. Make the work dir writable. The staging script now chmod 0777s
    ${LOCAL_DIR} before the container runs, so a non-root image user can write
    into the bind-mounted dir regardless of run options.

Both are null-safe/best-effort: if run options can't be resolved, the task runs
with none (today's behavior) rather than aborting.

Tests

3 new Spock tests (33 total, 0 failures):

  • buildRunLine splices run options before the image
  • buildRunLine omits the separator when no options given
  • staging script emits chmod 0777 and the resolved options reach the run line

Built + tested on JDK 17 / Nextflow 26.04.x.

Containerized tasks dropped the engine-scope `docker.runOptions` and the
per-process `containerOptions` directive, so a container that needed e.g.
`--user root` ran as the image's default user. Combined with a root-owned
bind-mounted work dir, a non-root image user couldn't write its outputs and
failed with "Permission denied".

resolveDockerRunOptions() now gathers both `docker.runOptions` (from the
task's ContainerConfig) and `containerOptions`, and buildRunLine splices them
verbatim before the image. The staging script also `chmod 0777`s the work dir
before the container runs, so a non-root user can write outputs regardless.
@scttfrdmn
scttfrdmn merged commit 5bf9b37 into main Jun 13, 2026
1 check passed
@scttfrdmn
scttfrdmn deleted the fix/39-honor-runoptions-writable-workdir branch June 13, 2026 20:56
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Task container ignores docker.runOptions and runs as non-root in a root-owned work dir → "Permission denied"

1 participant