nf-core tools in docker is broken
Description of the bug
Tools does not handle failure to create .config directory as it should. Lacking a proper $HOME it will default to / and try to create /.config
Command used and terminal output
pontus@atra:~$ docker run -itv `pwd`:`pwd` -w `pwd` -u $(id -u):$(id -g) nfcore/tools
Traceback (most recent call last):
File "/usr/local/bin/nf-core", line 5, in <module>
from nf_core.__main__ import run_nf_core
File "/usr/local/lib/python3.8/site-packages/nf_core/__main__.py", line 31, in <module>
nf_core.utils.setup_nfcore_dir()
File "/usr/local/lib/python3.8/site-packages/nf_core/utils.py", line 310, in setup_nfcore_dir
os.makedirs(NFCORE_DIR)
File "/usr/local/lib/python3.8/os.py", line 213, in makedirs
makedirs(head, exist_ok=exist_ok)
File "/usr/local/lib/python3.8/os.py", line 223, in makedirs
mkdir(name, mode)
PermissionError: [Errno 13] Permission denied: '/.config'
pontus@atra:~$
System information
No response
I'm having the same issue, do you have a solution @pontus ?
Yes, simply pointing HOME somewhere writable will get you through, e.g. adding -e HOME=/tmp.
@pontus Ah its as simple as that! Thanks for the fix.
Hi, i'm having the same identical problem, but the solution you gave is not working for me, do you have any other suggestion? thanks!
ok, solved it. I was putting it at the end, but moving the -e before the -w made the trick. Thanks!
Would adding $HOME=/root to the dockerfile solve this issue?
No, that would cause the same kind of breakage as we already see. When running as root the current setup works (excluding side-effects like permissions of files created).
In fact, I'd rather expect it would break running this with singularity (where $HOME is typically set correctly).
Hi @pontus,
I am using a remote instance of HTCondor and following their guide to place the https://hub.docker.com/r/nfcore/tools/tags docker. It gave me the same error message although I used "export HOME=$PWD". I dd above too but none of them worked and gave me
"Traceback (most recent call last):
File "/usr/local/bin/nf-core", line 5, in
I'm not sure what command you used but if running with docker, it won't help changing the environment outside. Rather you need to pass the environment you want to be seen explicitly e.g. with -e.
I'm at the site that @kumarage mentioned. They were using the "container universe" of HTCondor to run the Docker container. In this case, we had to use the environment command in the HTCondor submit file. This in turn passes the environment variables to the docker run command that is executed by HTCondor, using the -e option.
# HTCondor submit file
universe = container
container_image = docker://nfcore/tools:latest
environment = "HOME=$$(CondorScratchDir)"
arguments = "list rna-seq"
...
($$(CondorScratchDir) is special syntax for the submit file that passes the scratch directory for the job after it lands on a worker machine.)
Hello, I see you found a solution for this, can I close the issue or is there something missing?
I'd prefer leaving this open, it's still broken.