miykael / nipype_env

A Docker image for a basic nipype environment
BSD 3-Clause "New" or "Revised" License
2 stars 6 forks source link

Some environment variables are not set #1

Open iglpdc opened 7 years ago

iglpdc commented 7 years ago

I'm working with your level_4 container (thanks for setting this up!) trying to use SPM without matlab. In the Dockerfile you set several environment variables, but when I run the container not all of them are set.

This is the output of docker inspect --format='{{ json .Config.Env }}:

["NB_UID=3602288","PATH=/usr/lib/fsl/5.0:/opt/conda/envs/python2/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin","DEBIAN_FRONTEND=noninteractive","CONDA_DIR=/opt/conda","SHELL=/bin/bash","NB_USER=jovyan","HOME=/home/jovyan","LC_ALL=en_US.UTF-8","LANG=en_US.UTF-8","LANGUAGE=en_US.UTF-8","NEURODEBIAN_URL=http://neuro.debian.net/lists/jessie.de-md.full","XDG_CACHE_HOME=/home/jovyan/.cache/","FSLDIR=/usr/share/fsl/5.0","FSLOUTPUTTYPE=NIFTI_GZ","FSLMULTIFILEQUIT=TRUE","POSSUMDIR=/usr/share/fsl/5.0","LD_LIBRARY_PATH=/opt/mcr/v91/runtime/glnxa64:/opt/mcr/v91/bin/glnxa64:/opt/mcr/v91/sys/os/glnxa64:/opt/mcr/v91/sys/opengl/lib/glnxa64:/usr/lib/fsl/5.0:","FSLTCLSH=/usr/bin/tclsh","FSLWISH=/usr/bin/wis","MATLAB_VERSION=R2016b","MCR_VERSION=v91","MCR_INHIBIT_CTF_LOCK=1","SPM_VERSION=12","SPM_REVISION=r6906","SPM_DIR=/opt/spm12","SPM_EXEC=/opt/spm12/spm12"]

You see that for example, none of the variables you set in the level_2 and level_3 Dockerfiles are set, nor it is MATLAB_CMD.

Note also that Ants and AFNI paths are not in PATH.

miykael commented 7 years ago

Hi @iglpdc, thank you for your input. I had the suspicion that it doesn't take over the ENV variables, but I didn't know how to check for it. Thanks to your input, now I know, thanks!

I guess the best thing is to put them all in startup.sh script and have it run at the end of each Dockerfile. What do you recommend?

I'm very sorry for it, but I'm still playing around with the "order of the levels". I want to create a relative small image, to teach people nipype (see https://github.com/miykael/nipype_course) and I guess it makes more sense to move FreeSurfer to level4 and SPM to level2.

miykael commented 7 years ago

Out of curiosity, how did you find this?

iglpdc commented 7 years ago

Hi @miykael. I'm not sure which is the best way to proceed. I'm pretty new to docker. I made a small PR that I think it fixes one of the issues with the ENV variables, but I'm not sure if this is all. (I don't have a good machine to test it).

Eventually, I think what it'd be really useful would be to have the different apps in different containers and be able to call them from nipype. But I don't know really which is the best way to go.

For example, I'm currently working on a pipeline that I'd like to run with both SPM8 and SPM12, basically to see how switching to the newer version affects the results. It'd be nice if I could use all the same containers and just "switch" the SPM container from version 8 to 12, without having to rebuild a big container with the whole stack.

I found this repo thru your awesome tutorials for nipype (thanks for that too!).

miykael commented 7 years ago

Thanks for your changes. I'm looking into them now and I will test them on my machine to make sure that everything works nicely.

I'm also new to docker, that's why there's still many changes in my files. But yes, your right. It would be great if Nipype could decide which containers to get. But I'm not sure if this can be done, within the container. Also, I think they always have to be stacked on top of each other.

Hmm.. you're right, let me see if I can add SPM8.

miykael commented 7 years ago

@iglpdc, no I mixed everything up a bit, but it hopefully will work. I have to check it on https://hub.docker.com/r/miykael/.

I was looking into SPM8. The problem is that SPM needs to be the standalone version, so that it can work with MCR (MATLAB Compiler Runtime, see https://en.wikibooks.org/wiki/SPM/Standalone). The current SPM12 version is like this. If you can provide me with an SPM8 version, than I'm happy to add it in the Dockerfile.