Running software in a container

Once you have transferred a container image to your system you can use the enclosed software.

The following command will make a container from the image file (.sif), run the software, and then collapse the container. The output from the software will be save in your current directory, unless specified otherwise.

singularity exec CONTAINER_NAME.sif YOUR_SCRIPT_HERE

The first part of the command singularity exec CONTAINER_NAME.sif specifies information about the container; the second part of the command (YOUR_SCRIPT_HERE) relates to the command you want the software inside the container to execute.

Substitute:

  • CONTAINER_NAME for the name of the container you wish to use, and
  • YOUR_SCRIPT_HERE for the full command to execute the tool.

Example

This exec command allows you to execute a custom command (cowsay moo) within a container by specifying the image file (lolcow_latest.sif):

singularity exec lolcow_latest.sif cowsay moo

The following command executes shovill --check inside a container named shovill_latest.sif.

singularity exec shovill_latest.sif shovill --check

Information

By default, Singularity automatically connects folders outside and inside the container; this means you can easily process data saved on your system and save the results. Your outputs are not lost when the container is collapsed.