jpvaldes / cbbs-imaging-container-mriqc

mriqc singularity container built from official dockerhub repository
0 stars 1 forks source link

Two ways to build the singularity image #2

Open mslw opened 6 years ago

mslw commented 6 years ago

Hi

When building the singularity image myself, I was puzzled by the entrypoint of the resulting mriqc container. I now believe that such behaviour is fully intended by singularity, but following the suggestion from @bpoldrack I am describing the situation below, hoping it might come useful to you.

I am using singularity-2.4 via vagrant and virtualbox (on MacOS).

Specifically, I noticed that if I build the container using: singularity build mriqc.img docker://poldracklab/fmriprep, the runscript of such image (checked by singularity inspect --runscript) gets automatically set to exec "/usr/local/miniconda/bin/mriqc".

As a result, it cannot be used as an executable directly, but has to be launched using singularity exec ....

However, I can also use the following build specification file (saved in the example below as Singularity) to change the runscript ($@ ensures that arguments are passed along from the user):

Bootstrap: docker
From: poldracklab/mriqc:0.10.4

%runscript

    /usr/local/miniconda/bin/mriqc $@

The image can then be built by running sudo singularity build mriqc.img Singularity. I can execute this image directly: ./mriqc.img bids-root/ output-folder/ participant

I find the latter behaviour more natural -- but in the end, using it would require changing the datalad wrapper, so I leave the decision to you.

Relevant Singularity docs:

bpoldrack commented 6 years ago

Thanks for pointing that concisely out, @mslw . We should build it that way, since BIDSApps are actually meant to be used that way. However, I'm currently refining the implementation of how to use containers with datalad, so we better come up with the next version of this dataset afterwards. So - if you don't see it changed very soon, don't take that as a rejection of the approach. ;-)