This guide is intended for creating Singularity containers on a computer where you have root (administrative) privileges and then using the container on the HPC resources.
1. Installation of Singularity and its dependencies
Singularity cannot be directly installed on windows. The user needs any VM software to run a linux system under their windows env. A thorough guide for installation via apt, yum, rpmor from source can be found at https://docs.sylabs.io/guides/3.0/user-guide/installation.html
2. Creating a container
In order to run singularity containers on the HPC resources we will need to create .sif image files which are compressed and immutable which ensures reproducibility of results. Since the process of creating sif files requires root privileges it needs to be done on a machine where the creator has root access(meaning that it cannot be done on HPC resources) and then transferred to your personal HPC directory.
Images can either be created using Definition files(.def) or a writable environment can be created and modified to specifications. Both the .def file and the writable environment can be converted to sif files.
a. Building a sif image file from a definition file:
sudo singularity build IMAGENAME.sif DEFINITIONFILE.def
b. Building a sif image file from a premade container with either:
sudo singularity build IMAGENAME.sif docker://godlovedc/lolcow
sudo singularity build IMAGENAME.sif library://sylabs-jms/testing/lolcow
c. Building a writable container:
sudo singularity build --sandbox CONTAINERNAME/ docker://godlovedc/lolcow
d. Running a writable container after creating it:
sudo singularity shell -writable CONTAINERNAME/
e. Converting a writable container to sif image:
sudo singularity build IMAGENAME.sif CONTAINERNAME/
3. Running the container
Containers can either be called to run scripts/commands directly using exec:
singularity exec IMAGENAME.sif COMMAND
OR they can be used as an environment to work with using shell:
singularity shell IMAGENAME.sif
also they can be used to run predefined scripts with run:
singularity run IMAGENAME.sif
4. Sending the container to your directory
This section assumes that an HPCF account exists and the ssh keys are setup properly.
scp IMAGENAME.sif mpantekhis@cyclone.hpcf.cyi.ac.cy:~/IMAGENAME.sif
The path after ":" can be changed to any folder in your Cyclone home directory.