Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Tierpsy Docker: investigate whether running the docker container as root is necessary #10

Open
taylorreiter opened this issue Sep 20, 2024 · 1 comment

Comments

@taylorreiter
Copy link
Member

In the Snakefile, we're currently running the docker container as root user:

rule run_tierpsy_tracker:
    ...
    shell:
        """
        docker exec -u root \
        ...
        """

In #6, @keithchev asked:

Is -u root necessary? afaik it's a bad practice to run containers as root (though I think it's also common, so probably nbd here)

It was necessary in my testing, but that was before I added umask 000 to the beginning of the bash code run by docker exec. I need to investigate whether it is still necessary or can be run without this.

@taylorreiter
Copy link
Member Author

Ok I tried this out on a toy snakefile running the same docker exec command and found that -u root is necessary. Without it, I get:

Traceback (most recent call last):
  File "/home/tierpsy_user/.local/bin/tierpsy_process", line 33, in <module>
    sys.exit(load_entry_point('tierpsy', 'console_scripts', 'tierpsy_process')())
  File "/tierpsy-tracker/tierpsy/processing/processMultipleFilesFun.py", line 133, in tierpsy_process
    processMultipleFilesFun(**vars(args))
  File "/tierpsy-tracker/tierpsy/processing/processMultipleFilesFun.py", line 117, in processMultipleFilesFun
    files_checker = CheckFilesForProcessing(**check_args)
  File "/tierpsy-tracker/tierpsy/processing/CheckFilesForProcessing.py", line 46, in __init__
    self.mask_dir_root = _makeDirIfNotExists(mask_dir_root)
  File "/tierpsy-tracker/tierpsy/processing/CheckFilesForProcessing.py", line 41, in _makeDirIfNotExists
    os.makedirs(fname)
  File "/usr/local/lib/python3.6/os.py", line 220, in makedirs
    mkdir(name, mode)
PermissionError: [Errno 13] Permission denied: '/DATA/local_drive/tmp_tierpsy_out/masks'

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant