Singularity

Description

Singularity enables users to have full control of their environment. This means that a non-privileged user can "swap out" the operating system on the host for one they control. So if the host system is running RHEL6 but your application runs in Ubuntu, you can create an Ubuntu image, install your applications into that image, copy the image to another host, and run your application on that host in it's native Ubuntu environment!

Home Page

singularity.lbl.gov

Documentation

singularity.lbl.gov/user-guide

License

Singularity is released under a BSD license with 2 modifications. (see LICENSE file for more details).

Usage

Use

module avail singularity

to see which versions of singularity are available. Use

module load singularity/version

to get access to singularity. Use

singularity --help

to get help. To run singularity in a job script, use

singularity exec [exec options...] <container-path> <command>

The container can be either in Abel's shared repository (for Abel maintained containers) or a custom container, e.g. in your home directory. The Abel shared repository is:

/cluster/software/singularity-img/

Example:

module load singularity
singularity exec /cluster/software/singularity-img/bowtie1-abel.img bowtie --version

Create your own containers

Creating singularity containers require sudo rights, which means that you cannot create containers on Abel. You may install singularity on your desktop/laptop where you have admin rights, create your containers there, then run them on Abel.

Important note: To be able to read/write data from/to system paths from within the containers, you must in the definition file create directories with the same names on the system. For Abel you should add:

mkdir /cluster /work /usit /projects

For TSD:

mkdir /cluster /work /tsd /projects

There are mainly two ways to create a singularity container:

Pure singularity containers

  • Create a bootstrap definition file (see examples ).
  • Create a new empty container image. Example creating an image with max size of 1 GiB:
sudo singularity create --size 1024 ./bowtie1.img
  • Bootstrap:
sudo singularity bootstrap ./bowtie1.img <definition-file-path>

More description can be found here

Converted Docker to singularity containers

  • Create a bootstrap definition file where Docker is the source. Example for a container converted from the genomicpariscentre/bowtie1:latest docker image:
BootStrap: docker
From: genomicpariscentre/bowtie1:latest

%runscript
    echo "This is what happens when you run the container..."

%post
    mkdir /cluster /work /usit /projects
  • Create a container image (same as above) taking into account adjusting the size option to a value that matches the original docker image size.
  • Bootstrap

Some useful tips from one of our users about how to use singularity on Abel can be found here

More about Docker and singularity can be found here

Important note: Not all Docker images can be converted successfully to singularity containers. This feature is still under development. So, you need to properly test the singularity container before starting to use it on Abel.

GPU containers - best practices

TBD

Withdrawn support for some Singularity versions

There has been security issues with some versions of Singularity. For this reason, the following versions are not available:

  • 2.3.1
  • 2.3.2

Images build for these versions of Singularity should run fine with other versions of Singularity. Please contact us if you experience problems with this.

By Abdulrahman Azab
Published Mar. 24, 2017 5:56 PM - Last modified Oct. 30, 2018 2:11 PM