There are several ways to build Singularity* containers described in the Singularity official documentation.
This section demonstrates how to build a container for an MPI application from scratch using recipes. Singularity recipes are files that include software requirements, environment variables, metadata, and other useful details for designing a custom container.
A recipe file consists of the header and sections. The header part defines the core operating system and core packages to be installed. In particular:
The content of a recipe file is divided into sections that execute commands at different times during the build process. The build process stops if a command fails. The main sections of a recipe are:
After the recipe file is created, use it to create a Singularity container. The example below shows how to build a container with default parameters:
$ singularity build mpi.img ./Singularity_recipe_mpi