broadinstitute/ml4h

make it easier to run ml4cvd for users without root access

StevenSong opened this issue · 2 comments

What
running ml4cvd in docker creates output folders made by root user because docker runs things as root by default. the user should be able to set if the output is owned by root or by the current logged in user.

Why
On machines where user has non root access, should be able to manage (delete) output without hacky solutions

How
Admittedly, the how is also hacky, set user and group id using the -u flag (use current user), docker won't know who the user and group id are but it sets the correct permission in the host system

Acceptance Criteria
files created by ml4cvd are owned by non-root

erikr commented

This is a better-worded resurrection of an issue I gave up on #104

@paolodi, I recall we discussed this and you had an idea for a fix. Any suggestions?

Any suggestions?

-u flag to docker
this blogpost is pretty good https://jtreminio.com/blog/running-docker-containers-as-current-host-user/

the big takeaway is to truly get it to use the user and know WHO the user is, it's alot of effort. I did some testing and just getting docker to use the userid is good enough, the guest container will not know who the name of the user but will still use the userid. the host system then knows who the id maps to.

here's the exact flag and options to docker run command:
-u $(id -u ${USER}):$(id -g ${USER})