Apptainer

Modified

2026-05-14

Current Status

  • Installed Version: 1.4.2 (latest as of December 2024)
  • Installation Method: Direct .deb package installation

Installation Methods for Ubuntu 24.04

Why No APT Repository?

As of December 2024, Apptainer does not provide an official APT repository for Ubuntu. This is different from the old Singularity days when there was a Sylabs PPA. The official installation methods are:

  1. Direct .deb Download (Recommended)
  2. Build from Source
  3. Install via Conda/Mamba

Method 2: Build from Source

For those who need custom builds:

# Install dependencies
sudo apt update
sudo apt install -y build-essential libseccomp-dev pkg-config \
    uidmap squashfs-tools squashfuse fuse2fs fuse-overlayfs \
    fakeroot cryptsetup curl wget git

# Get source
export VERSION=1.4.2
wget https://github.com/apptainer/apptainer/releases/download/v${VERSION}/apptainer-${VERSION}.tar.gz
tar -xzf apptainer-${VERSION}.tar.gz
cd apptainer-${VERSION}

# Configure and build
./mconfig
make -C builddir
sudo make -C builddir install

Method 3: Via Conda/Mamba

For user-space installation:

conda install -c conda-forge apptainer
# or
mamba install -c conda-forge apptainer

Version History

The package you have installed (1.4.2-1~jammy) indicates it was likely installed:

  • From a previous Ubuntu 22.04 installation that was upgraded
  • From a manual .deb download
  • From a now-removed repository

Key Differences from Singularity

Apptainer is the continuation of Singularity after it joined the Linux Foundation:

  • Singularity CEApptainer (open source, Linux Foundation)
  • Singularity ProSingularityPRO (commercial, Sylabs)

SUID vs Non-SUID

  • With SUID: Unprivileged users can build and run containers using kernel features
  • Without SUID: Only root can use certain features; regular users limited to pre-built containers

To check SUID status:

ls -la /usr/libexec/apptainer/bin/starter-suid

Environment Variables

Key variables to configure:

# Cache directory for images
export APPTAINER_CACHEDIR=/var/cache/apptainer

# Temporary directory for builds
export APPTAINER_TMPDIR=/tmp

# Bind paths (directories accessible in containers)
export APPTAINER_BINDPATH=/data,/scratch

Common Commands

# Pull from Docker Hub
apptainer pull docker://ubuntu:22.04

# Pull from Singularity Hub  
apptainer pull shub://vsoch/hello-world

# Build from definition file
sudo apptainer build container.sif definition.def

# Run container
apptainer run container.sif

# Shell into container
apptainer shell container.sif

# Execute command
apptainer exec container.sif python script.py

# Inspect container
apptainer inspect container.sif

Troubleshooting

Cache Issues

# Clear cache
apptainer cache clean

# List cache
apptainer cache list

Permission Issues

  • Ensure SUID is installed for unprivileged builds
  • Check bind paths are accessible
  • Verify cache directory permissions

Network Issues in Containers

Add --net flag:

apptainer shell --net container.sif

Migration from Singularity

Apptainer is fully compatible with Singularity containers:

  • .sif files work without modification
  • Definition files (.def) are compatible
  • Commands are nearly identical (replace singularity with apptainer)

Resources

  • Official Docs: https://apptainer.org/docs/user/latest/
  • GitHub: https://github.com/apptainer/apptainer
  • Definition File Guide: https://apptainer.org/docs/user/latest/definition_files.html
  • Docker to Apptainer: https://apptainer.org/docs/user/latest/docker_and_oci.html