Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
runner.singularity: Allow writes to HOME on the container filesystem
Our recent upgrade of Snakemake in our container image¹ resulted in an fatal error when used with the Singularity runtime, e.g.: OSError: [Errno 30] Read-only file system: '/home/runner' We first observed this in periodic CI for Nextstrain CLI, but were able to reproduce it outside CI. The error comes from Snakemake inside the container (newly) trying to `mkdir -p` paths under HOME and represents two separate-but-intertwined bugs: the first being the read-only container filesystem preventing creation under HOME, and the second that the value of HOME from outside the container (e.g. /home/runner in CI) is leaking into the container. The read-only filesystem previously wasn't an issue (and wasn't noticed) because writes were limited to paths bind-mounted read-write from outside the container (e.g. /nextstrain/build). Writing to the container filesystem has always been allowed in the Docker runtime, so we come to parity with it using --writable-tmpfs, which requires Singularity 3.0.0. The HOME leak arose thru a intersection of behaviours. Our container image sets HOME=/nextstrain², but this is a *default* value that can be overridden at container launch time. With our Docker runtime, it's never overridden. Singularity, however, automatically forwards the user's HOME value into the container, even though we use --no-home to disable mounting the user's home at the same path. The forwarded value thus override our image's default. Providing an explicitly empty HOME value via the --home option allows the image default to apply, as expected. Resolves: <#274> ¹ <nextstrain/docker-base#136> ² <https://github.com/nextstrain/docker-base/blob/1b0d1998/Dockerfile#L390>
- Loading branch information