Skip to content
Snippets Groups Projects

Singularity / Apptainer

A repository of definition files for building Singularity containers around the software applications, frameworks, and libraries you need to run on high-performance computing systems.

Based on naked-singularity. Thanks M. Kandas

Please note that since 2022 there is a Linux Foundation Version of singularity called apptainer. Currently developments are similar.

Install Singularity / Apptainer

Install Singularity on your Linux desktop, laptop, or virtual machine. You need root permissions to use and install the package.

There is a general install script that installs version 3.5.3 (can be easily changed to 3.8 or 3.9) from source, but there are also binary packages build for modern OS (Server OS). e.g. Red Hat, Arch, ...

more informaiton on building from source can be found here: Installing Singularity Documentation

# Centos / Red Hat
sudo yum update -y && \
    sudo yum install -y epel-release && \
    sudo yum update -y && \
    sudo yum install -y singularity

# Arch / Manjaro
sudo pamac install singularity-container

# Manual using this script (builds from source)
sudo ./install-singularity.sh install

e.g. Ubuntu does not have the package in the repos, but a deb file exists in the releases. See below.

Please note that these versions can vary substantially. Please check that at least version 3.5 is available or for newer distributions use apptainer.

prebuild binary releases

If you can not find singularity or apptainer in your repos, there are prebuild packages available as well. Go to the github release singularity or apptainer page.

# e.g. for Ubuntu
wget https://github.com/apptainer/apptainer/releases/download/v1.1.0/apptainer_1.1.0_amd64.deb
sudo dpkg -i apptainer_1.1.0_amd64.deb
# gives some errors of missing dependencies. solve running:
sudo apt-get -f install
# Retry and see that is completes successfully
sudo dpkg -i apptainer_1.1.0_amd64.deb
# done

Build your first Singularity container from a definition file

Build an Ubuntu Singularity container from one of the definition files available in this repository.

sudo singularity build ubuntu.sif definition-files/ubuntu/Singularity.ubuntu-18.04

Build your first Singularity container from a DockerHub

Build an Ubuntu Singularity container from the DockerHub repository

# Using Ubuntu 18.04
sudo singularity build ubuntu.sif docker://ubuntu:18.04
# Using Ubuntu 20.04
sudo singularity build ubuntu.sif docker://ubuntu:20.04

Pull your first Singularity container from IMGW Sylab Cloud

We try to build custom Singularity containers with signatures to help keeping track of changes and interoperability.

# You need to do this only once.
# add the library (no login required)
singularity remote add --no-login sycloud cloud.sylabs.io
# make it the default one
singularity remote use sycloud
# check if you get access
singularity remote status
    INFO:    Checking status of default remote.
    SERVICE    STATUS  VERSION                 URI
    Builder    OK      v1.6.7-0-gebd61128      https://build.sylabs.io
    Consent    OK      v1.6.6-0-gd8f171e       https://auth.sylabs.io/consent
    Keyserver  OK      v1.18.9-0-g76cbd56      https://keys.sylabs.io
    Library    OK      v0.3.7-rc.2-0-gd7bd65e  https://library.sylabs.io
    Token      OK      v1.6.6-0-gd8f171e       https://auth.sylabs.io/token

    No authentication token set (logged out).
# Now pull the container
singularity pull ubuntu.sif library://mblaschek/imgw/ubuntu:20.04 

Note: With the pull command you do not need root access. Everybody can pull a container and execute it as ones own process.

Inspiration

There are more and more people trying to build/port software to containers and building recipes collections to share experience.