|
Article ID: 721
Last updated: 25 Jun, 2026
The information provided in this article can be used on your workstation to build an Apptainer image. Some information here is also useful if you want to grab a ready-to-use Apptainer image from online resources for use on NAS systems. Note: To use Apptainer on a NAS host machine, load an appropriate Apptainer module (apptainer/x86-toss4, apptainer/x86-toss5, apptainer/arm-toss5) depending on which architecture (x86_64 or aarch64) and operating system (toss4 or toss5) are on the host. See the second half of Enabling User-Defined Software Stack with Apptainer for more information. Building an Apptainer ImageTo build an Apptainer image, use the following:
The image_path target specifies the output from the build process. The output can be one of the two formats:
To build a compressed Apptainer read-only image, use the default format:
To build a read/write container within a directory structure, use the sandbox option:
Note: It is common to use the sandbox mode to develop the container, as the image is writable. You can shell into it and install software and dependencies (some may require root privilege), until you are satisfied that your container will meet your needs. You can then build the container as a default Apptainer image for production use. The default format cannot be altered after it is created. Warning: While you can write to a sandbox on your local workstation, writing to a sandbox is not allowed on NAS systems. You should rely on the use of the Apptainer definition file to adjust what is included in the container.
A build_spec target can be local or remote. Acceptable formats for local targets include:
For remote targets, use one of the following acceptable uniform resource identifiers (URI):
More details can be found here. Examples for Building Apptainer ImagesExample 1: Build an image from the GtHub Container Registry (GHCR) under Docker:
Example 2: Build an image from a definition (DEF) file by following these steps. Note: This example is taken from Building containers from Apptainer definition files from the the Apptainer quickstart guide.
Example 3 Build a sandbox directory (named lolcow_from_sif) from the SIF file:
Example 4 Build a SIF image (lolcow_new.sif) from the sandbox directory:
|