What is Singularity?
A Singularity container is used to encapsulate all required software and dependencies for a workflow. This is extremely useful when trying to execute a particular workflow on different systems. Containers make compiling software on different compute platforms easy and effortless. The best part is you don’t need admin privileges with Singularity if you are working on a cluster unlike other containers, such as Docker. In other words, Singularity facilitates a mobile workspace of software. In this way, Singularity containers are incredibly useful to the open-source community by contributing to the reproducibility of workflows and tools.
Steps to Build a Singularity Container from Scratch on Carbonate:
Ensure Singularity is installed on your system (https://sylabs.io/ ). If you’re working on a cluster, it’s likely Singularity is already loaded as a module. For example, to load Singularity on Carbonate, use the following command: <module load singularity>
The definitions file provides a set of instructions on how to build your container image. This provides information about the base container operating system, environment variables, software, container metadata etc. The .def recipe file must be created prior to building your Singularity container. For more information, see the link here: https://sylabs.io/guides/3.7/user-guide/definition_files.html .
Here is an example .def recipe:

Log into your Singularity account. If you don’t already have an account, you can sign-up with your GitHub Account, etc.

Once signed-in, navigate to the keystore.

Now you’ll want to generate a new token.

Name your token and generate.

Copy the API token or download the file (or both to be safe).

Option 1: Build Container Image on the Command Line
Log into your HPC account. In this tutorial, I’ll be using Carbonate at IU. Navigate to ~/.singularity/ and transfer this sylabs-token file to this directory. This will become more relevant after we generate our container image from the Singularity recipe file.

Navigate back to your working directory and execute the following commands. This will build your container image (rna.sif) from the recipe file (rna.def).

After your container image is built, you can then shell-into your container and execute commands from tools and libraries in your container.

Option 2: Build Container Image with Remote Builder
You can also build you image file on Singularity’s website. From the Keystore, navigate to the Remote Builder. Here we will build our container image from our .def recipe file.

Next you will want to upload the rna.def file from the aforementioned GitHub repo to the Remote Builder.

After uploading, your Remote Builder should look something like this. Next, click “Build”. You can actively watch your container image being build with Singularities Remote Builder.

Navigate to the Cloud Library and select the image you created.

You can either download this image or you can follow the command-line instructions in code box shown below.
