Description
Apptainer (formerly 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 RHEL9 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
Documentation
https://apptainer.org/documentation/
License
https://apptainer.org/docs/user/latest/license.html#license
Usage
Use on submit nodes
Use on Colossus
Apptainer is installed on the compute nodes as a system package (not a software module).
To run an Apptainer container in a job script, use
apptainer exec [exec options...]<container-path> <command>
Use
apptainer --help
to get help.
Binding filesystems
On Colossus the GPFS filesystem is mounted under /gpfs with symlinks from /cluster to mirror the setup on the submit hosts. By default, Apptainer will bind $HOME, /gpfs and /cluster into Apptainer containers that run on the compute nodes (what you submit via a job script) to allow reading from and writing to durable, /cluster and $HOME.
To specify additional bind paths use the --bind argument:
apptainer exec --bind <path1>,<path2><container-path> <command>
Building Apptainer images
Due to a lack of admin privileges and internet access, TSD does not support building Apptainer images inside TSD. Apptainer images must be built outside TSD and then imported into TSD. Please reference the Apptainer documentation for local installation on Linux, Mac or Windows and how to build containers.
Building containers from Apptainer definition files (outside TSD)
- Create a bootstrap definition file:
Bootstrap: docker From: ubuntu:16.04 %post apt-get -y update apt-get -y install fortune cowsay lolcat %environment export LC_ALL=C export PATH=/usr/games:$PATH %runscript fortune | cowsay | lolcat
- Then build the image using the following command:
sudo apptainer build lolcow.sif lolcow.def
Converted Docker to apptainer containers (outside TSD)
Apptainer can directly fetch and build containers using Docker/OCI container images from a registry.
Example building a Apptainer Image Format container from Docker Hub's alpine:3 image:
apptainer build alpine.sif docker://docker.io/alpine:3
Please reference the documentation on Apptainer's interoperability with Docker.
GPU containers
To run GPU enabled containers on the GPU nodes, pass the --nv argument:
apptainer exec --nv<container-path> <command>