You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: pages/docs/overview/faq.md
+28-64Lines changed: 28 additions & 64 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -8,53 +8,27 @@ folder: docs
8
8
## General Singularity info
9
9
10
10
### Why the name "Singularity"?
11
+
A "Singularity" is an astrophysics phenomenon in which a single point becomes infinitely dense. This type of a singularity can thus contain massive quantities of universe within it and thus encapsulating an infinite amount of data within it.
11
12
12
-
The name "Singularity" for me (Greg) stems back from my past experience working at a company called <ahref="https://en.wikipedia.org/wiki/Linuxcare"target="_blank">Linuxcare</a> where the Linux Boot-able Business Card (LNX-BBC) was developed. The BBC, was a Linux rescue disk which paved the way for all live CD bootable distributions using a loop back file system called the "singularity".
13
+
Additionally, the name "Singularity" for me (Greg) also stems back from my past experience working at a company called <ahref="https://en.wikipedia.org/wiki/Linuxcare"target="_blank">Linuxcare</a> where the Linux Boot-able Business Card (LNX-BBC) was developed. The BBC, was a Linux rescue disk which paved the way for all live CD bootable distributions using a compressed single image file system called the "singularity".
13
14
14
-
This nomenclature represented that all files within the environment were contained within a single file, and for the same reason Singularity emphasizes the same nomenclature. (Thanks LNX-BBC!)
15
+
The name has **NOTHING** to do with Kurzweil's (among others) prediction that artificial intelligence will abruptly have the ability to reprogram itself, surpass that of human intelligence and take control of the planet. If you are interested in this may I suggest the movie **Terminator 2: Judgement Day**.
15
16
17
+
### What is so special about Singularity?
18
+
While Singularity is a container solution (like many others), Singularity differs in it's primary design goals and architecture:
16
19
17
-
### Which namespaces are virtualized? Is that select-able?
18
-
19
-
The goal of Singularity is to run an application within a contained environment such as it was not contained. Thus there is a balance between what to separate and what not to separate. At present the virtualized namespaces are process, mount points, and certain parts of the contained file system.
20
-
21
-
When you run your Singularity container, you may find that the process IDs start with 1 (one) and increment from there. You will also find that while the file system is contained starting with '/' (root), you can have access outside the container via your starting path. This means that relative paths will resolve outside the container, and fully qualified paths will resolve inside the container.
22
-
23
-
To achieve this behavior, you will find that several Linux namespaces are separated (PIDS, file systems and descriptors, mounts, and root file system). These can be enabled or disabled by the build and what namespaces the host system supports as well as through environment variables.
24
-
20
+
1.**Reproducible software stacks:** These must be easily verifiable via checksum or cryptographic signature in such a manner that does not change formats (e.g. splatting a tarball out to disk). By default Singularity uses a container image file which can be checksummed, signed, and thus easily verified and/or validated.
21
+
2.**Mobility of compute:** Singularity must be able to transfer (and store) containers in a manner that works with standard data mobility tools (rsync, scp, gridftp, http, NFS, etc..) and maintain software and data controls compliancy (e.g. HIPPA, nuclear, export, classified, etc..)
22
+
3.**Compatibility with complicated architectures:** The runtime must be immediately compatible with existing HPC, scientific, compute farm and even enterprise architectures any of which maybe running legacy kernel versions (including RHEL6 vintage systems) which do not support advanced namespace features (e.g. the user namespace)
23
+
4.**Security model:** Unlike many other container systems designed to support *trusted users running trusted containers* we must support the opposite model of *untrusted users running untrusted containers*. This changes the security paradigm considerably and increases the breadth of use cases we can support.
25
24
26
-
### Can't you do this with Docker?
27
-
Singularity has taken off within the scientific computing world because Docker, while fantastic for enterprise services and local use, is a no starter on traditional HPC resources. There are no HPC centers utilizing Docker on their traditional HPC resources because it is inheritiatnly incompatible with HPC.
28
-
29
-
Singularity has a very different usage model then Docker in that Singularity utilizes complete image files while Docker containers are made up of layers of tar files. With Singularity, you can prefetch an entire container, cache it on shared optimized storage, and run it from there. Singularity also limits user privileges and access from within the container, making it safe for user's to bring their own containers. It doesn't open up security risks of users being able to control a root owned daemon, and it integrates seemlessly into existing process and resource manager workflows, supports GPU, MPI, architecture independent, among lots of other aspects that Docker does not.
30
-
31
-
In the end, Docker is designed for micro-service network virtulization and emulation of the full isolation requirements in the legacy of full machine level virtualization platforms (e.g. VMWare, Xen, KVM, etc.). Singularity is designed specifically for the scentific, application and environment virtulization. The right tool for the right job. :)
32
-
33
-
If you already have a Docker container you can port it directly into a Singularity image!
### How does Singularity relate/differ from other container technology?
48
-
Singularity differs from other container systems in several major ways that impact usability on shared systems. For example, most container systems emulate standard systems in that there is the ability and necessity to escalate to root, run on separate IP/network address, run services, and in some cases even virtually boot the container system.
49
-
50
-
Singularity on the other hand focuses on the ability to virtualized only what is necessary to achieve run-time application container and portable environments. For instance, you can not obtain root from within a Singularity container.
51
-
52
-
There are some additional performance and design enhancements which make Singularity also more appropriate in a scheduled HPC environment. The back-end image type is one such feature that negates the need for temporary caching of container images and optimizes meta-data IO (especially on parallel file systems). Another feature is how Singularity interacts with the host operating system to facilitate application work-flows like X11 and MPI.
26
+
### Which namespaces are virtualized? Is that select-able?
27
+
That is up to you!
53
28
54
-
### How does Singularity relate/differ from statically compiled binaries?
55
-
Statically compiled binaries are a good comparison to what Singularity can do for a single program because it will package up all of the dynamic libraries and package them into a single executable (interpreted) format.
29
+
While some namespaces, like newns (mount) and fs (file system) must be virtualized, all of the others are conditional depending on what you want to do. For example, if you have a workflow that relies on communication between containers (e.g. MPI), it is best to not isolate any more then absolutely necessary to avoid performance regressions. While other tasks are better suited for isolation (e.g. web and data base services).
56
30
57
-
But because Singularity is actually wrapping operating system files in to a container, you can do much more with it... Such as include other files, scripts, work-flows, pipe lines, data, and multi program processes and package them into a single portable executable format.
31
+
Namespaces are selected via command line usage and system administration configuration.
58
32
59
33
### What Linux distributions are you trying to get on-board?
60
34
All of them! Help us out by letting them know you want Singularity to be included!
@@ -63,13 +37,12 @@ All of them! Help us out by letting them know you want Singularity to be include
63
37
## Basic Singularity usage
64
38
65
39
### Do you need administrator privileges to use Singularity?
66
-
You generally do not need admin/sudo to use Singularity containers. As of version 2.3, you can create, import, run, export, and shell without it. You do however need admin/root access to install Singularity and to bootstrap a container (build it from a specification file called `Singularity`). This means that, given that your cluster has Singularity installed, you are empowered to generate your own portable environments.
40
+
You generally do not need admin/sudo to use Singularity containers but you do however need admin/root access to install Singularity and for some container build functions (for example, building from a recipe, or a writable image).
67
41
68
-
This then defines the work-flow to some extent. If you have a container (whether Singularity or Docker) ready to go, you can run/shell/import without root access. If you want to build and bootstrap, then your Singularity container image must be built and configured on a host where you have root access (this can be a physical system or on a VM or Docker image). And of course once the container image has been configured it can be used on a system where you do not have root access as long as Singularity has been installed there.
42
+
This then defines the work-flow to some extent. If you have a container (whether Singularity or Docker) ready to go, you can run/shell/import without root access. If you want to build a new Singularity container image from scratch it must be built and configured on a host where you have root access (this can be a physical system or on a VM). And of course once the container image has been configured it can be used on a system where you do not have root access as long as Singularity has been installed there.
69
43
70
44
71
45
### What if I don't want to install Singularity on my computer?
72
-
73
46
If you don't want to build your own images, <ahref="https://singularity-hub.org"target="_blank">Singularity Hub</a> will connect to your Github repos with build specification files, and build the containers automatically for you. You can then interact with them easily where Singularity is installed (e.g., on your cluster):
74
47
75
48
```bash
@@ -80,7 +53,9 @@ singularity build hello-world.simg shub://vsoch/hello-world # redundant, you wou
80
53
```
81
54
82
55
### Can you edit/modify a Singularity container once it has been instantiated?
83
-
We strongly advocate for reproducibility, so if you build a squashfs container, it is immutable. However, if you build with `--sandbox` or `--writable` you can produce a writable sandbox folder or ext3 image, respectively. From a sandbox you can develop, test, and make changes, and then build into a full squashfs image. We recommend to our users to use the compressed, immutable format for production containers.
56
+
We strongly advocate for reproducibility, so if you build a squashfs container, it is immutable. However, if you build with `--sandbox` or `--writable` you can produce a writable sandbox folder or a writable ext3 image, respectively. From a sandbox you can develop, test, and make changes, and then build or convert it into a standard image.
57
+
58
+
We recommend to use the default compressed, immutable format for production containers.
84
59
85
60
### Can multiple applications be packaged into one Singularity Container?
86
61
Yes! You can even create entire pipe lines and work flows using many applications, binaries, scripts, etc.. The `%runscript` bootstrap section is where you can define what happens when a Singularity container is run, and with the introduction of [modular apps](/docs-apps) you can now even define `%apprun` sections for different entrypoints to your container.
@@ -98,45 +73,45 @@ singularity run --bind /home/vanessa/Desktop:/data container.img
98
73
99
74
100
75
### How does Singularity handle networking?
101
-
As of 2.4, Singularity now has the ability to support instances, each with their own Network namespace, and the starting behavior defined by the `%startscript`. Without running as an instance, Singularity does no network isolation and runs like any other application on the system. It has all of the same networking privileges as any program running as that user. This means that if you run a process in the container directed to localhost, it will show up on your host machine browser as localhost. Take a look at some of our <ahref="https://github.com/vsoch/singularity-web"target="_blank">web examples</a> to get a sense for this.
76
+
As of 2.4, Singularity can support the network namespace to a limited degree. At present, we just use it for isolation, but it will soon be more featurefull.
102
77
103
78
104
-
### Can a Singularity container be multi-threaded?
79
+
### Can Singularity support daemon processes?
80
+
Singularity has container "instance" support which allows one to start a container process, within its own namespaces, and use that instance like it was a stand alone, isolated system.
81
+
82
+
At the moment (as above describes), the network (and UTS) namespace is not well supported, so if you spin up a process daemon, it will exist on your host's network. This means you can run a web server, or any other daemon, from within a container like and access it directly from your host.
105
83
84
+
### Can a Singularity container be multi-threaded?
106
85
Yes. Singularity imposes no limitations on forks, threads or processes in general.
107
86
108
87
### Can a Singularity container be suspended or check-pointed?
88
+
Yes and maybe respectively. Any Singularity application can be suspended using standard Linux/Unix signals. Check-pointing requires some preloaded libraries to be automatically loaded with the application but because Singularity escapes the hosts library stack, the checkpoint libraries would not be loaded. If however you wanted to make a Singularity container that can be check-pointed, you would need to install the checkpoint libraries into the Singularity container via the specfile.
109
89
110
-
Yes and maybe respectively. Any Singularity application can be suspended using standard Linux/Unix signals. Check-pointing requires some preloaded libraries to be automatically loaded with the application but because Singularity escapes the hosts library stack, the checkpoint libraries would not be loaded. If however you wanted to make a Singularity container that can be check-pointed, you would need to install the checkpoint libraries into the Singularity container via the specfile
90
+
On our roadmap is the ability to checkpoint the entire container process thread, and restart it. Keep an eye out for that feature!
111
91
112
92
113
-
### Are there any special requirements to use Singularity through a job scheduler?
114
-
93
+
### Are there any special requirements to use Singularity through an HPC job scheduler?
115
94
Singularity containers can be run via any job scheduler without any modifications to the scheduler configuration or architecture. This is because Singularity containers are designed to be run like any application on the system, so within your job script just call Singularity as you would any other application!
116
95
117
96
118
97
### Does Singularity work in multi-tenant HPC cluster environments?
119
-
120
98
Yes! HPC was one of the primary use cases in mind when Singularity was created.
121
99
122
100
Most people that are currently integrating containers on HPC resources do it by creating virtual clusters within the physical host cluster. This precludes the virtual cluster from having access to the host cluster's high performance fabric, file systems and other investments which make an HPC system high performance.
123
101
124
102
Singularity on the other hand allows one to keep the high performance in High Performance Computing by containerizing applications and supporting a runtime which seamlessly interfaces with the host system and existing environments.
125
103
126
104
### Can I run X11 apps through Singularity?
127
-
128
105
Yes. This works exactly as you would expect it to.
129
106
130
107
### Can I containerize my MPI application with Singularity and run it properly on an HPC system?
131
-
132
108
Yes! HPC was one of the primary use cases in mind when Singularity was created.
133
109
134
110
While we know for a fact that Singularity can support multiple MPI implementations, we have spent a considerable effort working with Open MPI as well as adding a Singularity module into Open MPI (v2) such that running at extreme scale will be as efficient as possible.
135
111
136
112
note: We have seen no major performance impact from running a job in a Singularity container.
137
113
138
114
### Why do we call 'mpirun' from outside the container (rather then inside)?
139
-
140
115
With Singularity, the MPI usage model is to call 'mpirun' from outside the container, and reference the container from your 'mpirun' command. Usage would look like this:
141
116
142
117
```bash
@@ -149,9 +124,7 @@ In the end, we do not gain anything by calling 'mpirun' from within the containe
149
124
150
125
See the Singularity on HPC page for more details.
151
126
152
-
153
127
### Does Singularity support containers that require GPUs?
154
-
155
128
Yes. Many users run GPU dependant code within Singularity containers. The
156
129
experimental `--nv` option allows you to leverage host GPUs without installing
157
130
system level drivers into your container. See the [`exec`](/docs-exec#a-gpu-example) command for
@@ -160,7 +133,6 @@ an example.
160
133
## Container portability
161
134
162
135
### Are Singularity containers kernel dependent?
163
-
164
136
No, never. But sometimes yes.
165
137
166
138
Singularity is using standard container principals and methods so if you are leveraging any kernel version specific or external patches/module functionality (e.g. OFED), then yes there maybe kernel dependencies you will need to consider.
@@ -172,19 +144,16 @@ There is also some level of glibc forward compatibility that must be taken into
172
144
note: If you require kernel dependent features, a container platform is probably not the right solution for you.
173
145
174
146
### Can a Singularity container resolve GLIBC version mismatches?
175
-
176
147
Yes. Singularity containers contain their own library stack (including the Glibc version that they require to run).
177
148
178
149
### What is the performance trade off when running an application native or through Singularity?
179
-
180
150
So far we have not identified any appreciable regressions of performance (even in parallel applications running across nodes with InfiniBand). There is a small start-up cost to create and tear-down the container, which has been measured to be anywhere from 10 - 20 thousandths of a second.
181
151
182
152
## Misc
183
153
184
154
The following are miscellaneous questions.
185
155
186
156
### Are there any special security concerns that Singularity introduces?
187
-
188
157
No and yes.
189
158
190
159
While Singularity containers always run as the user launching them, there are some aspects of the container execution which requires escalation of privileges. This escalation is achieved via a SUID portion of code. Once the container environment has been instantiated, all escalated privileges are dropped completely, before running any programs within the container.
@@ -193,14 +162,10 @@ Additionally, there are precautions within the container context to mitigate any
193
162
194
163
You can read more about the Singularity <ahref="/docs-security">security overview here</a>.
195
164
196
-
197
165
## Troubleshooting
198
-
199
166
A little bit of help.
200
167
201
-
202
168
### How to use Singularity with GRSecurity enabled kernels
203
-
204
169
To run Singularity on a GRSecurity enabled kernel, you must disable several security features:
205
170
206
171
```bash
@@ -252,11 +217,10 @@ Also, make sure you are using an up-to-date Singularity to bootstrap your contai
252
217
253
218
254
219
### Error running Singularity with sudo
255
-
256
220
This fix solves the following error when Singularity is installed into the default compiled prefix of /usr/local:
0 commit comments