nextflow-io / nextflow-io/training

Add user and group to all invocations of `docker run`

Open
#593 7 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

documentation improve
Dominant language
Nextflow
Stars
271
Forks
329
Avg merge
1d 1h
Merged PRs (30d)
11

Description

Discussion from Slack thread: https://nfcore.slack.com/archives/C043FMKUNLB/p1743470447418089

When running docker containers, either within Nextflow or on the command-line, it would be good practice to run as the user, so outputs are not written out as root user.

docker run --rm -it -u $(id -u):$(id -g) <image>

and

    docker {
        docker.enabled       = true
        docker.runOptions    = '-u $(id -u):$(id -g)'   // <- run as your user. Not root user.
    }

A drop-down box marked as a note, or a callout would also be useful the first time the user runs docker in the lesson. This would explain that docker containers are by default run as the user they were built with (often root user), and therefore the outputs written by the software are also owned by that user. In order to run as the user running the container, one needs to supply the -u option with the argument above.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Search the training lessons for every docker run invocation and the first place Docker is introduced. Review the Slack discussion and the existing command examples, then update the invocations and Docker guidance to use the current user's UID and GID, including a note or callout explaining root-owned outputs. Done means all relevant examples consistently include the user setting and the lesson explains why.

Written by the indexing model from the issue text.

Assessment

Tech stack
docker
Domain
documentation
Issue type
Documentation
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.