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
+15-76Lines changed: 15 additions & 76 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -24,70 +24,45 @@ To achieve this behavior, you will find that several Linux namespaces are separa
24
24
25
25
26
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.
27
28
28
-
No, not even close. If that was true, there would be no use for Singularity. But in fact, Singularity has taken off within the scientific computing world! Furthermore, if Docker can be used on traditional HPC resources, it would be; but it is not! There are no HPC centers utilizing Docker on their traditional HPC resources because it is inheritiatnly incompatible with HPC.
29
-
30
-
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
31
-
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.
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.
32
30
33
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. :)
34
32
35
-
If you already have a Docker container you can import/shell/run it directly into Singularity!
33
+
If you already have a Docker container you can port it directly into a Singularity image!
While Singularity can in fact operate on a chroot directory (thus giving users the ability to securely run within these directories) the feature set of Singularity goes leaps and bounds beyond! For example, chroot can not operate on directories, utilize kernel namespaces, or be used by users (without SUID even when the user namespace is supported). chroot does not support blurring the line between container and host with bind mounts, devices, and does not limit security access for users, or integrate with traditional HPC resources and services.
52
-
53
-
54
-
### How does Singularity relate/differ from Shifter?
55
-
56
-
NERSC (like most HPC centers) are feeling the pressure from users asking for support for containers, specifically Docker. Due to the architecture of Docker it is very difficult (if not impossible) to properly and securely implement in a multi-tenant HPC environment. Shifter is NERSC's implementation to provide a Docker compatible front-end interface to their extreme scale HPC resources. It is system/resource specific in that you must import an existing container (from Docker, Singularity, or other), to the host/Shifter implementation.
57
-
58
-
Singularity on the other hand does not leverage the Docker work-flow and targets a different premise - Mobility of Compute. This makes the integration of Singularity non-HPC specific (even though it works very well with HPC) and allows the image to become the primary unit of mobility (you can share and operate directly on Singularity images).
59
-
60
-
Singularity is more of a general purpose mobility of compute solution that is very capable at HPC, Shifter's primary focus is targeting extreme scale HPC and integration with Cray and the resource manager.
61
-
62
-
### How does Singularity relate/differ from Flatpak
63
-
64
-
Flatpak is a packaging subsystem that uses some container technologies to create distribution neutral packages and it is more similar to the initial proof of concept of Singularity. But the use-cases of Singularity dictated that we should support full operating system containers that contain the entire user's environment.
65
-
66
-
### How does Singularity relate/differ from other container systems like OpenVz, LXC/LXD, etc.?
67
46
68
-
47
+
### How does Singularity relate/differ from other container technology?
69
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.
70
49
71
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.
72
51
73
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.
74
53
75
54
### How does Singularity relate/differ from statically compiled binaries?
76
-
77
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.
78
56
79
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.
80
58
81
59
### What Linux distributions are you trying to get on-board?
82
-
83
60
All of them! Help us out by letting them know you want Singularity to be included!
84
61
85
62
86
63
## Basic Singularity usage
87
64
88
-
89
65
### Do you need administrator privileges to use Singularity?
90
-
91
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.
92
67
93
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.
@@ -98,29 +73,19 @@ This then defines the work-flow to some extent. If you have a container (whether
98
73
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):
singularity build hello-world.simg shub://vsoch/hello-world# redundant, you would already get an image
105
80
```
106
81
107
82
### Can you edit/modify a Singularity container once it has been instantiated?
108
-
109
-
Yes, if you call it with the `-w/--writable` flag. (e.g. 'singularity shell --writable Container.img'). However, we recommend to not do this as a regular practice, as it induces changes that are not recorded properly. If you need to rebuild the container, you would need to remember those commands.
110
-
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.
111
84
112
85
### Can multiple applications be packaged into one Singularity Container?
113
-
114
-
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. This definition takes priority over all "other places" that might define a container's execution. Specifically:
115
-
116
-
- The `%runscript` section of the bootstrap file takes priority over all
117
-
- If you bootstrap a docker image, the `ENTRYPOINT` is used if there is no `%runscript`
118
-
- If you add `Includecmd: yes` to your definition file header, the `CMD` is used instead
119
-
- No `%runscript`, `ENTRYPOINT` OR `CMD` means the container's default execution is `/bin/bash`
120
-
86
+
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.
121
87
122
88
### How are external file systems and paths handled in a Singularity Container?
123
-
124
89
Because Singularity is based on container principals, when an application is run from within a Singularity container its default view of the file system is different from how it is on the host system. This is what allows the environment to be portable. This means that root ('/') inside the container is different from the host!
125
90
126
91
Singularity automatically tries to resolve directory mounts such that things will just work and be portable with whatever environment you are running on. This means that `/tmp` and `/var/tmp` are automatically shared into the container as is `/home`. Additionally, if you are in a current directory that is not a system directory, Singularity will also try to bind that to your container.
@@ -133,33 +98,7 @@ singularity run --bind /home/vanessa/Desktop:/data container.img
133
98
134
99
135
100
### How does Singularity handle networking?
136
-
137
-
Singularity does no network isolation because it is designed to run like any other application on the system. It has all of the same networking privileges as any program running as that user. Thus, 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.
138
-
139
-
140
-
### Can I import an image from Docker?
141
-
142
-
Yes, you can do this with our import, even without sudo. With import, the Docker layers (the dump of files) plus the environment, and labels are added to the container.
You can also do this by way of bootstrapping Docker images, and to do this you would create a definition file, an image, and then bootstrap. First, here is most simplest definition file, "Singularity":
149
-
150
-
```bash
151
-
Bootstrap: docker
152
-
From: ubuntu:latest
153
-
```
154
-
155
-
Now let's create an image and bootstrap using the Singularity file:
156
-
157
-
```bash
158
-
$ singularity create ubuntu.img
159
-
$ singularity bootstrap ubuntu.img Singularity
160
-
```
161
-
162
-
Make sure you are running Singularity > 2.2 to make full use of this feature.
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.
163
102
164
103
165
104
### Can a Singularity container be multi-threaded?
0 commit comments