Skip to content
Snippets Groups Projects
Commit d1b75487 authored by Jan Siwiec's avatar Jan Siwiec
Browse files

Update singularity.md

parent f356318d
No related branches found
No related tags found
4 merge requests!368Update prace.md to document the change from qprace to qprod as the default...,!367Update prace.md to document the change from qprace to qprod as the default...,!366Update prace.md to document the change from qprace to qprod as the default...,!323extended-acls-storage-section
# Singularity Container # Singularity Container
[Singularity][a] enables users to have full control of their environment. A non-privileged user can "swap out" the operating system on the host for one they control. So if the host system is running RHEL6 but your application runs in Ubuntu/RHEL7, you can create an Ubuntu/RHEL7 image, install your applications into that image, copy the image to another host, and run your application on that host in its native Ubuntu/RHEL7 environment. [Singularity][a] enables users to have full control of their environment. A non-privileged user can "swap out" the operating system on the host for one they control. So if the host system is running RHEL6 but your application runs in Ubuntu/RHEL7, you can create an Ubuntu/RHEL7 image, install your applications into that image, copy the image to another host, and run your application on that host in its native Ubuntu/RHEL7 environment.
Singularity also allows you to leverage the resources of whatever host you are on. This includes HPC interconnects, resource managers, file systems, GPUs and/or accelerators, etc. Singularity does this by enabling several key facets: Singularity also allows you to leverage the resources of whatever host you are on. This includes HPC interconnects, resource managers, file systems, GPUs and/or accelerators, etc. Singularity does this by enabling several key facets:
...@@ -20,7 +20,7 @@ This documentation is for Singularity version 2.4 and newer. ...@@ -20,7 +20,7 @@ This documentation is for Singularity version 2.4 and newer.
## Using Docker Images ## Using Docker Images
Singularity can import, bootstrap, and even run Docker images directly from [Docker Hub][b]. You can easily run RHEL7 container like this: Singularity can import, bootstrap, and even run Docker images directly from [Docker Hub][b]. You can easily run an RHEL7 container like this:
```console ```console
hra0031@login4:~$ cat /etc/redhat-release hra0031@login4:~$ cat /etc/redhat-release
...@@ -37,7 +37,7 @@ Singularity centos:latest:~> cat /etc/redhat-release ...@@ -37,7 +37,7 @@ Singularity centos:latest:~> cat /etc/redhat-release
CentOS Linux release 7.4.1708 (Core) CentOS Linux release 7.4.1708 (Core)
``` ```
In this case, image is downloaded from Docker Hub, extracted to a temporary directory and Singularity interactive shell is invoked. This procedure can take a lot of time, especially with large images. In this case, the image is downloaded from Docker Hub, extracted to a temporary directory, and Singularity interactive shell is invoked. This procedure can take a lot of time, especially with large images.
## Importing Docker Image ## Importing Docker Image
...@@ -47,7 +47,7 @@ Singularity containers can be in three different formats: ...@@ -47,7 +47,7 @@ Singularity containers can be in three different formats:
* writable **ext3** (--writable option) * writable **ext3** (--writable option)
* writable **(ch)root directory** (--sandbox option) - best for development * writable **(ch)root directory** (--sandbox option) - best for development
Squashfs and (ch)root directory images can be built from Docker source directly on the cluster, no root privileges are needed. It is strongly recomended to create native Singularity image to speed up the launch of the container. Squashfs and (ch)root directory images can be built from Docker source directly on the cluster, no root privileges are needed. It is strongly recommended to create a native Singularity image to speed up the launch of the container.
```console ```console
hra0031@login4:~$ ml Singularity hra0031@login4:~$ ml Singularity
...@@ -83,7 +83,7 @@ DISTRIB_CODENAME=xenial ...@@ -83,7 +83,7 @@ DISTRIB_CODENAME=xenial
DISTRIB_DESCRIPTION="Ubuntu 16.04.3 LTS" DISTRIB_DESCRIPTION="Ubuntu 16.04.3 LTS"
``` ```
A command can be run inside the container (without interactive shell) by invoking `singularity exec` command. A command can be run inside the container (without an interactive shell) by invoking the `singularity exec` command.
``` ```
hra0031@login4:~$ singularity exec ubuntu.img cat /etc/lsb-release hra0031@login4:~$ singularity exec ubuntu.img cat /etc/lsb-release
...@@ -93,7 +93,7 @@ DISTRIB_CODENAME=xenial ...@@ -93,7 +93,7 @@ DISTRIB_CODENAME=xenial
DISTRIB_DESCRIPTION="Ubuntu 16.04.3 LTS" DISTRIB_DESCRIPTION="Ubuntu 16.04.3 LTS"
``` ```
Singularity image can contain a runscript. This script is executed inside the container after the `singularity run` command is used. The runscript is mostly used to run an application for which the container is built. In the following example it is `fortune | cowsay` command. A singularity image can contain a runscript. This script is executed inside the container after the `singularity run` command is used. The runscript is mostly used to run an application for which the container is built. In the following example, it is the `fortune | cowsay` command:
``` ```
hra0031@login4:~$ singularity run ubuntu.img hra0031@login4:~$ singularity run ubuntu.img
...@@ -109,7 +109,7 @@ hra0031@login4:~$ singularity run ubuntu.img ...@@ -109,7 +109,7 @@ hra0031@login4:~$ singularity run ubuntu.img
## Accessing /HOME and /SCRATCH Within Container ## Accessing /HOME and /SCRATCH Within Container
User home directory is mounted inside the container automatically. If you need access to **/SCRATCH** storage for your computation, this must be mounted by `-B | --bind` option. A user home directory is mounted inside the container automatically. If you need access to the **/SCRATCH** storage for your computation, this must be mounted by the `-B | --bind` option.
!!!Warning !!!Warning
The mounted folder has to exist inside the container or the container image has to be writable! The mounted folder has to exist inside the container or the container image has to be writable!
...@@ -122,7 +122,7 @@ Singularity ubuntu.img:~> ls /scratch ...@@ -122,7 +122,7 @@ Singularity ubuntu.img:~> ls /scratch
ddn sys temp work ddn sys temp work
``` ```
Comprehensive documentation can be found at the [Singularity][c] website. A comprehensive documentation can be found at the [Singularity][c] website.
[a]: http://singularity.lbl.gov/ [a]: http://singularity.lbl.gov/
[b]: https://hub.docker.com/ [b]: https://hub.docker.com/
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment