I followed the instructions on using fmriprep with Docker as indicated in the documentation, and run the command below: fmriprep-docker /path/to/data/dir /path/to/output/dir participant
The resulting output directory and files are owned by root. Is there a way to have the files owned by the user running the that command?
You can’t with fmriprep-docker as currently written, but it does print the generated docker command. You can try adding the --user flag, but I don’t know that it works.
Thanks @oesteban. To make sure, this is to be done before running fmriprep, is that right?
Also, what about the suggestion of @effigies (thank you @effigies for this) , to use the --user flag? Would that work to have all the files and directories being owned by a given user? Should the two methods proposed be combined to set both user and group ownership, or is there also a --group flag to set both ownership in one go when running the docker command?
Hi @michael, if you’ve already run fmriprep, then you’ll need both commands. From that moment on, you’ll have the new permissions set. But yes, ideally, you will want to do that ahead of time.
If you give @effigies’ suggestion a try, I would suggest using your user and group ids like --user $(id -u):$(id -g). The docker image of FMRIPREP does not have any users created, so the behavior in this case is quite unpredictable. I’ve just given it a try and it apparently works.
We had the same thought/issue. After fiddling with the docker syntax, the following worked for us (at least so far without error, the pipeline is still running…):
The second addition (-w=/out) was necessary since in our version of fmriprep (1.1.2) the WORKDIR is set to a folder within /root/src, which is not accessible for regular UIDs.
In the latest release of fmriprep (1.1.3, came out last Tuesday) we have addressed both concerns. Now the fmriprep-docker interface will allow you to run as user setting a -u $(id -u). I’m not 100% sure about the group though, but in theory it should work out.
We have also changed the WORKDIR to /tmp, so it does not write to /root/src anymore.