Containers
Apptainer (formerly Singularity) is a container solution for scientific and application-driven workloads. See the Apptainer User Guide for details.
Build an Apptainer Container
Note
Admin assistance required
Apptainer requires fakeroot privilege for non-root users to create container images. Please contact an HAL admin or submit a support request to set up your account with fakeroot.
Build a container from an Apptainer recipe (
ubuntu1604-cuda92-ompi400.def
):wget https://wiki.ncsa.illinois.edu/download/attachments/82518873 ubuntu1604-cuda92-ompi400.def apptainer build ubuntu1604-cuda92-ompi400.sif ubuntu1604-cuda92-ompi400.def
Pull a container from Apptainer Hub or Docker Hub:
apptainer pull docker://nvidia/cuda-ppc64le:9.2-cudnn7-devel-ubuntu16.04
Run an Apptainer Container
Warning
Unlike Docker (which provides an isolated filesystem), Singularity mounts your home directory into the container. Be aware of this so you don’t accidentally delete things in your home directory.
Run a container with
exec
command:bashmpirun -n 4 apptainer exec --nv /opt/apps/samples-image/ubuntu1604-cuda92-ompi400.sif hostname
Run a container with shell:
bashapptainer shell --nv /opt/apps/samples-image/ubuntu1604-cuda92-ompi400.sif
Build a Writable Apptainer Container
By default, the Apptainer container filesystem is read-only. There are 2 options to build a writable Apptainer container.
--sandbox
The --sandbox
option allows users to create a container within a writable directory (a sandbox).
It’s possible to create a sandbox without root privileges, but to ensure proper file permissions it is recommended to do so as root.
apptainer build --sandbox cuda-ppc64le/ docker://nvidia/cuda-ppc64le:9.2-cudnn7-devel-ubuntu16.0
apptainer shell --writable cuda-ppc64le/
--writable
The --writable
option allows users to create a writable ext3 image.
Root privileges are required to create writable containers.
apptainer build --writable cuda-ppc64le.sif docker://nvidia/cuda-ppc64le:9.2-cudnn7-devel-ubuntu16.04
apptainer shell --writable cuda-ppc64le.sif
Build a Writable Apptainer Container Based on an Existing Read-Only Image
Convert it to a writable directory (a sandbox):
apptainer build --sandbox cuda-ppc64le-mod/ cuda-ppc64le.sif apptainer shell --writable cuda-ppc64le-mod/
Use an existing container as a target to build a new container
apptainer build --writable cuda-ppc64le-mod.sif cuda-ppc64le.sif apptainer shell --writable cuda-ppc64le-mod.sif
Run a Container with an x86 Architecture Image on an IBM ppc64le System
Apptainer cannot directly run x86 binaries on an IBM Power system because the bytes of machine code are different.
You need to make sure your images are built for ppc64le
rather than x86
.
--nv
Option
The --nv
option allows the Apptainer container to leverage the NVIDIA GPU on the host system.
Use this option if the container asks for nvidia-docker
support.