> For the complete documentation index, see [llms.txt](https://doane-ccla.gitbook.io/docs/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://doane-ccla.gitbook.io/docs/tools/singularity.md).

# Singularity Containers

*Written for software version 2.5.2.*

Singularity is a virtualization tool that allows users to containerize workflows, applications, and environments to allow for portability, customization, and reproducibility. Additionally, Singularity is integrated with the Message Passage Interface (MPI) to be used in High Performance Computing (HPC) systems as well as Virtual Machines (VMs) which enables a seamless workflow environment. Lastly, you may also utilize Docker containers with Singularity!

Note: These instructions are adapted from the [official Singularity documentation](https://www.sylabs.io/docs/).

## Prerequisites

* A command line environment in Ubuntu or CentOS.
* Software dependencies (these may be numerous):
  * Ubuntu

    ```bash
      sudo apt-get update && \
      sudo apt-get install \
      python \
      dh-autoreconf \
      build-essential \
      libarchive-dev
    ```
  * CentOS

    ```bash
      sudo yum update && \
      sudo yum groupinstall 'Development Tools' && \
      sudo yum install \
      libarchive-devel \
      squashfs-tools
    ```

## Singularity Installation

The most up-to-date version is housed in a GitHub repository. The software is installed from the source. Use Git to clone the repository and run the following commands.

```bash
git clone https://github.com/singularityware/singularity.git
cd singularity
./autogen.sh
./configure --prefix=/usr/local --sysconfdir=/etc
make
sudo make install
```

## Building a Container using an Existing Container

The following command executes the `build` command, specifies the path and name of the container (`lolcow.simg`), and provides the location of the container on the [Singularity Hub](https://www.singularity-hub.org/) (`shub://GodloveD/lolcow`).

```bash
singularity build lolcow.simg shub://GodloveD/lolcow
```

## Interacting with Containers

There are three primary ways to interact with a Singularity container.

1. Run: Creates an ephemeral container that runs a predefined script

   `singularity run lolcow.simg` or `./lolcow.simg`
2. Shell: Supplies a command line prompt to interface with the container

   `singularity shell lolcow.simg`
3. Execute: Sends a command into the container and provides output

   `singularity exec lolcow.simg`

Congratulations! You have successfully deployed a Singularity container!

As some next steps, navigate to the [official Singularity documentation](https://www.sylabs.io/docs/) to learn more about the [Singularity Hub](https://www.singularity-hub.org/), [Docker Hub](https://hub.docker.com/) and [building a container from scratch](https://www.sylabs.io/guides/2.5.1/user-guide/build_a_container.html).


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://doane-ccla.gitbook.io/docs/tools/singularity.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
