How-To: Singularity (Apptainer) – Using Docker Images on Hellbender

Summary

How to use Singularity on Hellbender.

Body

Why Use Singularity (Apptainer)?

Singularity (now known as Apptainer) is a container platform built specifically for High-Performance Computing (HPC). Unlike Docker, which requires elevated administrator privileges that are unsuitable for shared systems, Singularity allows users to run containers securely on multiuser clusters while maintaining portability and reproducibility. 

Docker images are widely used because they are the standard container format for many cloud-based HPC platforms, especially those built on Kubernetes. Although Docker itself cannot be used on Hellbender because it requires root privileges, Docker images can be imported and converted into Singularity images, making them fully usable on the cluster.

Docker vs. Singularity 

  • Docker is an excellent platform for application development and cloud deployments, but it is generally not permitted on shared HPC clusters because it requires administrator privileged execution.  

  • Singularity (Apptainer) was designed specifically for scientific computing, and can be used safely in multiuser HPC environments.  

  • Existing Docker images can be downloaded and converted into Singularity images with a single command. 

 

How-To: Singularity (Apptainer)

How-To Make a Docker Image a Singularity Image:

Thousands of publicly available Docker images can be found on Docker Hub: https://hub.docker.com/ 

Note: Only administrator accounts can modify existing Singularity SIF images directly on Hellbender. If you need to customize a container, build or modify it on your own Linux workstation and then transfer the completed .sif image to Hellbender for execution. 

  1. To download a Docker image containing the Ubuntu Linux distribution, run the following command from an interactive session (avoid doing this on a login node): 

singularity pull docker://ubuntu:22.04

This command creates a Singularity image named: ubuntu_22.04.sif

Basic Singularity Commands:

  1. Run a container:

singularity run ubuntu_22.04.sif

  1. Start an interactive shell:

singularity shell ubuntu_22.04.sif

  1. Execute a single command:

singularity exec ubuntu_22.04.sif python3 --version

Accessing Files with Bind Mounts:

Use bind mounts to give containers access to files stored on the host system instead of embedding data inside the container.  Using bind mounts is the recommended way to access input files, scripts, and large data sets stored on the host system without copying them into the container. 

By default, Singularity makes your $HOME and /tmp directories available inside the container. Additional directories can be exposed using the --bind option. 

Option Description Notes
--bind /host/path:/container/path Maps a directory from the host into the container. Multiple directories can be specified by separating them with commas.
  1. Run the bind mount code:

singularity exec --bind /mnt:/mnt ubuntu_22.04.sif ls /mnt

On Hellbender, user data is stored under /mnt, so after binding that directory you can access your files inside the container.

 

  1. Access your files inside the container:

singularity exec --bind /mnt:/mnt ubuntu_22.04.sif ls /mnt/pixstor/data/your_username/

Note: Replace your_username with your Hellbender username. 

Using NVIDIA GPUs 

  1. To enable NVIDIA GPU support, include the --nv option when launching the container: 

singularity exec --nv --bind /mnt:/mnt ubuntu_22.04.sif ls /mnt/pixstor/data/your_username/

The --nv flag makes the host's NVIDIA drivers and GPU devices available to applications running inside the container.

 

For Additional Assistance

A good introduction to Singularity containers for HPC users is available here: https://pawseysc.github.io/hpc-container-training/13-singularity-intro/index.html 

For additional assistance please e-mail itrss@missouri.edu.

Details

Details

Article ID: 2980
Created
Wed 11/18/26 3:11 PM
Modified
Wed 11/18/26 5:29 PM