A quick step-by-step guide to creating a Singularity container:
singularity build --sandbox debian docker://debian sudo singularity shell --writeable debian
Note: „sudo singulartiy“ is needed because you always keep the user you start the image as. So if you run singularity as root, you are root. In other words, if you're not root at startup, you won't be root at runtime! Also note that creating a singularity sandbox creates a directory, not an image file.
sudo singularity build debian.sif debian
debian.sif will be a single file, ready to go.
srun singularity exec <container> <command>
Where <container> is your image file and <command> is the path to your run script.
[___@frontend01 ~]$ srun --pty singularity run ~/debian.sif [___@node131 ~]$ cat /etc/os-release | grep PRETTY_NAME PRETTY_NAME="Debian GNU/Linux 12 (bookworm)"
Of course, you can use sbatch scripts instead of calling srun directly, and you can also pull a fresh container, which works on the cluster frontends:
singularity pull docker://ubuntu
When you open a shell on your singularity image, your outer home directory is always mounted inside the container as your inner home directory. So you can put a script in your home directory on the cluster and use it inside the container in your home directory.
So again, 2 things to remember when starting a Singularity container:
Some final notes: Running singularity on the frontends will cause a high load on the frontends and therefore we (the administrators) may kill this process if it disturbs other users. This is just a note and a reminder to always use srun or sbatch to start your project! ^^
Finally, we have Singularity versions 3.7.0, 3.1.0 and 2.7.5 installed on every machine. Please always use one of these versions (for compatibility reasons) until there is an update on the cluster.