Hi Peer, thanks for your detailed explanation on nipype & docker, that really sorted a few things out for me! After trying out what you proposed I think I got on the right track but of course, as always further questions came up and I hope that this reply is not completely overloaded with questions and text (probably it is). I tried to break it down in a ‘What I did so far part’ and a ‘Questions’ part in order to give it at least some structure.
What I did so far:
I followed your instructions and those from the the nipype tutorial (just to be able to use some already written scripts) and did the following:
docker run -it --rm -v C:/Users/Johannes.Wiesner/Documents/testing/test_nipype/workdir/:/home/neuro/nipype_tutorial -v C:/Users/Johannes.Wiesner/Documents/testing/test_nipype/data/:/data -v C:/Users/Johannes.Wiesner/Documents/testing/test_nipype/output/:/output -p 8888:8888 miykael/nipype_tutorial jupyter notebook
I then extracted all the content from the nipype_tutorial repository into my local working directory
C:/Users/Johannes.Wiesner/Documents/testing/test_nipype/workdir/ and also downloaded and extracted the ds000114 dataset into my data directory.
I then ran two example scripts, namely
notebooks/introduction_quickstart_non-neuroimaging and both scripts ran succesfully without any errors.
Then I also tried to to use the
nipype docker image and ran:
docker run -it --rm -v C:/Users/Johannes.Wiesner/Documents/testing/test_nipype/workdir/:/home/neuro/nipype_tutorial -v C:/Users/Johannes.Wiesner/Documents/testing/test_nipype/data/:/data -v C:/Users/Johannes.Wiesner/Documents/testing/test_nipype/output/:/output -p 8888:8888 nipype/nipype
For that created a dummy script that simply smoothes one nifti-file in the data set:
import nipype.interfaces.spm as spm
smooth = spm.Smooth()
# Note that you have to decompress the original file first
smooth.inputs.in_files = '/data/ds000114/sub-01/ses-test/anat/sub-01_ses-test_T1w.nii'
smooth.inputs.fwhm = [4, 4, 4]
Again, everything seemed to work fine.
Further Questions that came up:
However, I was not able to start jupyter-notebook from within the nipype container, which I found confusing in the beginning. Shouldn’t the ‘real’ nipype be able to to everything what the tutorial image can do? It took me while to find out that the nipype_tutorial uses Neurodocker which can build containers that include nipype, all the standard neuroimaging tools, conda, jupyter, etc.
1.) So am I right that I have to use the Neurodocker if I want to be able to have all the functionality from nipype with an additional IDE like jupyter notebook? If so, is there a newbie-friendly way to create a “minimal” docker image using Neurodocker that just has the standard software packages and all what the “typical user” needs (maybe there isn’t because there is no such thing as a standard solution)?
I also have a few “optional” questions that are not super important (i.e. they are not important in order to use nipype) but are still gnawing on my nerves and I would be very happy if would understand a little bit more to be more confident in using docker & nipype.
2.) I have the feeling that
WSL/WSL2 is often mentioned in the context of docker, nipype and Windows. When and why is it important to install
WSL on my Windows 10 machine? For example your wrote:
When running this command in your shell (whatever that is in windows10, NB: depending on your precise version you need
docker toolbox or
docker desktop ,
WSL , etc., please check this section from the MTL Brainhack School )
From what I’ve tried it seems that I could do everything what I wanted without having to install
WSL on my machine (which is not straightforward by the way on my machine due to extremely strict IT-restrictions, e.g. I am not even able to open the Microsoft Store). So when and why do I need
WSL? Also I thought the whole magic behind Docker was to be not be dependent on the OS? Isn’t it paradoxical then that you still have to install
WSL on your Windows computer?
3.) I haven’t really understood why one needs to type in the following lines when running a docker image:
Even after trying to get a better intuition on docker and ports (by doing the do the most straightforward thing: ‘what are ports docker?’) I haven’t really got satisfactory answers to get around this…I have the feeling that I get circular answers like “docker uses ports and that’s why you have to do type this in” instead of really understanding why I have to do this (where are these numbers like
8888:8888 coming from?). Of course I don’t want to blame anyone, maybe (probably) the whole thing is simply not straightfoward to explain in a few sentences to a IT-newbie like me.
4.) When running a docker image, one always seems to be provided with three links to choose from. The display looks something like this:
To access the notebook, open this file in a browser:
Or copy and paste one of these URLs:
Whenever I run a container, always only the last link works while the first two just lead to dead ends. Again, this is not a big problem, because I could do what I wanted, but why do I get provided with three links in the first place, and am I the only one that can always only use the last link?
Again, I hope that this reply is not a complete overkill, while writing this I also thought about breaking all those questions up into separate neurostars questions but then I thought, since this question already has such a generic title (“Using nipype via docker”) it might be also a good idea to post them all in here.