I'm trying to run a docker container from snakemake. The jobs run and produce the correct output but when they complete I get
(one of the commands exited with non-zero exit code; note that snakemake uses bash strict mode!)
and snakemake tries to remove the files.
Things I've tried to debug this:
Adding
|| true
,set +u
orexit 0
to the shell command in the ruleRunning the commands shown in
--printshellcmds
(they run fine)Putting the docker command in a bash script in 'strict' mode to see if there are any issues (there are not)
Printing the actual exit code in the
shell:
command of the rule and it prints 0Running the R script which is being called in the container directly from the snakemake (it works fine)
Adding
--user $(id -u):$(id -g)
to the docker run command suggested here: Snakemake claims rule exits with non-zero exit code, even with "|| true"?. This fails as the R script in the container has nowhere to write out intermediate files as my current user does not properly exist in the container
Here is the snakefile rule:
rule run_biospyder:
input:
counts = "{dir}/{name}_counts.csv",
metadata = "{dir}/{name}_metadata.csv",
output: directory("{dir}/{name}_output")
params:
dockervol = "/usr/src/data"
shell:
"""
docker run \
-v $PWD:{params.dockervol} biospyderpipeline \
--config-file {params.dockervol}/config.yml \
--counts {params.dockervol}/{input.counts} \
--samples {params.dockervol}/{input.metadata} \
--output {params.dockervol}/{output} \
--name {wildcards.name}
"""