tools icon indicating copy to clipboard operation
tools copied to clipboard

nf-core tools in docker is broken

Open pontus opened this issue 3 years ago • 12 comments

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

pontus avatar Oct 10 '22 16:10 pontus

I'm having the same issue, do you have a solution @pontus ?

scott-lsbdt avatar Oct 18 '22 15:10 scott-lsbdt

Yes, simply pointing HOME somewhere writable will get you through, e.g. adding -e HOME=/tmp.

pontus avatar Oct 19 '22 07:10 pontus

@pontus Ah its as simple as that! Thanks for the fix.

scott-lsbdt avatar Oct 19 '22 07:10 scott-lsbdt

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!

Dan2389 avatar Dec 02 '22 10:12 Dan2389

ok, solved it. I was putting it at the end, but moving the -e before the -w made the trick. Thanks!

Dan2389 avatar Dec 02 '22 10:12 Dan2389

Would adding $HOME=/root to the dockerfile solve this issue?

mashehu avatar Dec 02 '22 13:12 mashehu

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).

pontus avatar Dec 02 '22 13:12 pontus

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 from nf_core.main import run_nf_core File "/usr/local/lib/python3.11/site-packages/nf_core/main.py", line 24, in setup_nfcore_dir() File "/usr/local/lib/python3.11/site-packages/nf_core/utils.py", line 326, in setup_nfcore_dir os.makedirs(NFCORE_DIR) File "", line 215, in makedirs File "", line 225, in makedirs PermissionError: [Errno 13] Permission denied: '/.config'"

kumarage avatar Sep 25 '23 18:09 kumarage

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.

pontus avatar Sep 25 '23 20:09 pontus

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.)

aowen-uwmad avatar Sep 25 '23 21:09 aowen-uwmad

Hello, I see you found a solution for this, can I close the issue or is there something missing?

mirpedrol avatar Mar 12 '25 16:03 mirpedrol

I'd prefer leaving this open, it's still broken.

pontus avatar Mar 12 '25 16:03 pontus