Singularity is a container technology that enables users to include portions of the operating system along with an application so that an application designed to run on one version of an operating system can be run on a different one. For example, this enables running applications from Ubuntu or Debian on a CentOS or Red Hat system, or running an application that requires and older or newer version of the same operating system.
System administrators must create containers on ARC clusters, however, you can create Singularity containers on your own Linux system on which you have ‘root’ or
What is a Singularity container?
A Singularity container is designed to hold an application, or set of applications, and all the operating system libraries that are needed to run that application. Singularity containers typically are a single, large file, though there may be some exceptions to this.
Running an existing Singularity container
The Singularity program itself is provided by a module that must be loaded before the
singularity command is available.
$ module load singularity
We generally recommend that you use the default version of Singularity, though some older or newer versions may be available. Please open a ticket by sending e-mail to firstname.lastname@example.org if you have a question about the advisability of using a version different from the default.
Some installed applications on ARC clusters may use Singularity containers, as well.
The first step is to copy the Singularity container you wish to run. Let’s assume that you have copied it to the current directory, and that it is called
The most basic thing you can do is to run a shell inside the container, which is done with
$ cp /sw/examples/singularity/centos6.img ./ $ singularity shell centos6.img
The prompt will change, and you will have a shell inside the container. Here is an example of a short session to get information about what is in the container.
Singularity.centos6.img> uname -r CentOS Linux release 7.8.2003 (Core) Singularity.centos6.img> cat /etc/redhat-release CentOS release 6.8 (Final) Singularity.centos6.img> echo 'Hello from Singularity!' > hello.out Singularity.centos6.img> exit
uname -r command requests the Linux kernel information, and the
redhat-release file contains the operating system release name and version. Compare the output above, from the Singularity container, to the output below, from the Great Lakes operating system (generated on Jan 5, 2020 and may be different now).
$ uname -r 3.10.0-1127.18.2.el7.x86_64 $ cat /etc/redhat-release CentOS Linux release 7.8.2003 (Core)
The kernel is the same, because the kernel runs only on the host system. However, the release file contains different information.
You will also notice that the Singularity container has mapped some directories inside the container to the corresponding directories outside the container. We echoed some text into
hello.txt, and it was created in the folder from which the container was run.
$ ls centos6.img hello.out $ cat hello.out Hello from Singularity!
The configuration on ARC clusters is to automatically provide access to directories under
/nfs. Use the bind option,
-B, to bind other directories to your container. The most common use of this is to provide a directory on the host in a different location.
So, for example, if your program expects to find data under
/data that is really in
/home/grundoon/data, you might use
$ singularity run -B /home/grundoon/data:/data centos6.img hello.sh