1. Home
  2. NI Cluster
  3. Software
  4. Singularity Linux Container Platform

Singularity Linux Container Platform

Singularity containers provide an application virtualization layer for our users. There are a few singularity images located on mind ( /containers/images/ ) that can help users get started.

Here is some information on how to build a singularity image from an image on Docker Hub(provided by Eli Bulger in Dr. Barbara Shinn-Cunningham’s lab).

Start an interactive session:
srun -p cpu --cpus-per-task=1 --mem=10GB --time=4:00:00 --pty bash
Load singularity::
module load singularity
Create a directory to store your singularity image:
mkdir /user_data//my_images
Build the singularity image you desire. The commands typically follow the naming scheme shown below::
singularity build [file_name] [docker_file]
Example:
singularity build /user_data//my_images/fmriprep-.simg docker://poldracklab/fmriprep
Your image should build, then you are good to go!

Example using a mrtrix3 and fsl 1.0 singularity image built by David. It is located on the mind cluster in /containers/images/ and simple a test script.
[dpane@mind ~]$ srun -p cpu --cpus-per-task=1 --mem=10GB --time=4:00:00 --pty bash
[dpane@mind-0-12 ~]$ module load singularity
[dpane@mind-0-12 ~]$ singularity exec --nv /containers/images/ubuntu-16.04-mrtrix3_fsl_v1.0.img bash
INFO: Could not find any NVIDIA binaries on this host!
dpane@mind-0-12:~$ pwd
/home/dpane
dpane@mind-0-12:~$ cd singularity_example/
dpane@mind-0-12:~/singularity_example$
#!/bin/bash

echo "Beginning of my test script"
which fsl;
echo "Inital check of what the FSLDIR is set to: $FSLDIR"; 
echo "Now set FSLDIR=/opt/fsl"
FSLDIR=/opt/fsl; 
echo "Check the FSLDIR again: $FSLDIR";
echo "Now checking to see if we can see fsl using the command: which fsl"
which fsl
echo "listing of /opt"
ls /opt
echo "Command: which flirt"
which flirt
echo "Command: flirt -version"
flirt -version
echo "Command: which eddy"
which eddy
echo "Command: eddy"
eddy
echo "This is the end of my test script"

dpane@mind-0-12:~/singularity_example$
dpane@mind-0-12:~/singularity_example$ ./test.sh
Beginning of my test script
/opt/fsl/bin/fsl
Inital check of what the FSLDIR is set to:
Now set FSLDIR=/opt/fsl
Check the FSLDIR again: /opt/fsl
Now checking to see if we can see fsl using the command: which fsl
/opt/fsl/bin/fsl
listing of /opt
fsl mrtrix3
Command: which flirt
/opt/fsl/bin/flirt
Command: flirt -version
FLIRT version 6.0
Command: which eddy
/opt/fsl/bin/eddy
Command: eddy
***************************************************
The following COMPULSORY options have not been set:
--imain File containing all the images to estimate distortions for
--mask Mask to indicate brain
--index File containing indices for all volumes in --imain into --acqp and --topup
--acqp File containing acquisition parameters
--bvecs File containing the b-vectors for all volumes in --imain
--bvals File containing the b-values for all volumes in --imain
--out Basename for output
***************************************************

Part of FSL (build 500)
eddy
Copyright(c) 2011, University of Oxford (Jesper Andersson)

Usage:
eddy --monsoon

Compulsory arguments (You MUST set one or more of):
--imain File containing all the images to estimate distortions for
--mask Mask to indicate brain
--index File containing indices for all volumes in --imain into --acqp and --topup
--acqp File containing acquisition parameters
--bvecs File containing the b-vectors for all volumes in --imain
--bvals File containing the b-values for all volumes in --imain
--out Basename for output

Optional arguments (You may optionally specify one or more of):
--session File containing session indices for all volumes in --imain
--topup Base name for output files from topup
--flm First level EC model (linear/quadratic/cubic)
--fwhm FWHM for conditioning filter when estimating the parameters
--niter Number of iterations (default 5)
--resamp Final resampling method (jac/lsr)
--repol Detect and replace outlier slices
-v,--verbose switch on diagnostic messages
-h,--help display this message

This is the end of my test script
dpane@mind-0-12:~/singularity_example$
dpane@mind-0-12:~/singularity_example$
dpane@mind-0-12:~/singularity_example$
dpane@mind-0-12:~/singularity_example$ exit
exit
[dpane@mind-0-12 ~]$ exit
exit
[dpane@mind ~]$
Updated on January 11, 2022
Was this article helpful?

Related Articles

Need Help?
Can't find the answer you're looking for?
Contact NI Support