Write permission issue when using nipype/nipype docker image

When I do a dicom import using nipype, I encounter the following error.

Ahoi hoi @foucault,

thanks for the post!
Could you maybe provide further details on your setup (OS, docker images, etc.)
and what you’re trying to do, so that we get an idea, can reproduce the problem
and subsequently help you as much as possible?

Cheers, Peer

Description: Ubuntu 18.04.2 LTS
Release: 18.04
Codename: bionic

Docker image: nipype/nipype:latest, image id: 0726a68cdd6a (I am not sure if image id is universal?)

Scripts:
“”"
import nipype.interfaces.spm.utils as spmu
file_list = get_dicom_file_name_list(_f)
di = spmu.DicomImport()
di.inputs.output_dir = “/home/foucault/output/”
di.inputs.in_files = [str(i) for i in file_list]
di.run()
“”"

Sorry I didn’t show too much information. In addition, if I run docker with --user root, there is no issue but the output .nii would have root:root ownership which probably would affect the subsequent process. I expect the output file to have $user:$user ownership.

Thanks for your time!
Best,
Foucault