Singularity is a container technology that does not require root permissions to run, so it is compatible with often permission-constrained High-Performance Compute (HPC) environments. It works on MacOS, Windows and Linux. Debian presents it as the package singularity-container. Please also inspect backports.debian.org for latest versions backported to earlier Debian releases.

Singularity has several ways to bootstrap its containers:

The workflow towards a working image is always

1. Create an empty image

2. Fill the image by one of the bootstrap methods

Once the image is available, you either work with it by asking for a shell to execute in the container or to execute a binary of the container directly. By default, the binary as access to the same files that you have access to. But this can be constrained as appropriate in the bootstrap file.

Example 1: Extend a Docker image

A bootstrap does not seem to take any time than a start from an existing docker image. Except for the specification of the bootstrap, the exact same commands are to be executed.

1. Install the Debian package for singularity sudo apt-get install singularity-container

2. Prepare configuration instruction

cat >> Singularity_Docker
Bootstrap: docker
From: debian:latest

3. Create empty container singularity create /tmp/mycontainer.img

4. Fill the container sudo singularity bootstrap /tmp/mycontainer.img Singularity_Docker

5. Get a shell executed within the container singularity shell /tmp/mycontainer.img

Example 2: Bootstrap from scratch

A bootstrap does not seem to take more time than a start from an existing docker image. Except for the specification of the bootstrap, the exact same commands are to be executed.

1. Install the Debian package for singularity sudo apt-get install singularity-container

2. Prepare configuration instruction

cat >> Singularity_Bootstrap
bootstrap: debootstrap
MirrorURL: http://httpredir.debian.org/debian
OSVersion: unstable
Include: vim

3. Create empty container singularity create /tmp/mycontainer.img

4. Fill the container sudo singularity bootstrap /tmp/mycontainer.img Singularity_Bootstrap

5. Get a shell executed within the container singularity shell /tmp/mycontainer.img

The decision for Docker is easy for best possible compatibility with an earlier effort or when reorganising the data is considered too tedious.

In analogy to the already so popular Docker technology, Singularity also features a repository of readily usable/extendable images at https://singularity-hub.org.

See also

Please address http://singularity.lbl.gov/tutorials and https://singularity-hub.org/faq for more. Additional tantalizing instructions for HPC environments you find on https://hpc.nih.gov/apps/singularity.html and https://github.com/NIH-HPC/Singularity-Tutorial.