1singularity(1) singularity(1)
2
3
4
6 singularity-exec - Run a command within a container
7
8
9
11 singularity exec [exec options...]
12
13
14
16 singularity exec supports the following formats:
17
18
19 *.sif Singularity Image Format (SIF). Native to Singular‐
20 ity 3.0+
21
22
23 *.sqsh SquashFS format. Native to Singularity 2.4+
24
25
26 *.img ext3 format. Native to Singularity versions < 2.4.
27
28
29 directory/ sandbox format. Directory containing a valid root
30 file
31 system and optionally Singularity meta-data.
32
33
34 instance://* A local running instance of a container. (See the
35 instance
36 command group.)
37
38
39 library://* A SIF container hosted on a Library
40 (default https://cloud.sylabs.io/library)
41
42
43 docker://* A Docker/OCI container hosted on Docker Hub or an‐
44 other
45 OCI registry.
46
47
48 shub://* A container hosted on Singularity Hub.
49
50
51 oras://* A SIF container hosted on an OCI registry that sup‐
52 ports
53 the OCI Registry As Storage (ORAS) specification.
54
55
56
58 --add-caps="" a comma separated capability list to add
59
60
61 --allow-setuid[=false] allow setuid binaries in container (root
62 only)
63
64
65 --app="" set an application to run inside a container
66
67
68 --apply-cgroups="" apply cgroups from file for container processes
69 (root only)
70
71
72 -B, --bind=[] a user-bind path specification. spec has the format
73 src[:dest[:opts]], where src and dest are outside and inside paths. If
74 dest is not given, it is set equal to src. Mount options ('opts') may
75 be specified as 'ro' (read-only) or 'rw' (read/write, which is the de‐
76 fault). Multiple bind paths can be given by a comma separated list.
77
78
79 --blkio-weight=0 Block IO relative weight in range 10-1000, 0 to
80 disable
81
82
83 --blkio-weight-device=[] Device specific block IO relative weight
84
85
86 -e, --cleanenv[=false] clean environment before running container
87
88
89 --compat[=false] apply settings for increased OCI/Docker compati‐
90 bility. Infers --containall, --no-init, --no-umask, --no-eval,
91 --writable-tmpfs.
92
93
94 -c, --contain[=false] use minimal /dev and empty other directories
95 (e.g. /tmp and $HOME) instead of sharing filesystems from your host
96
97
98 -C, --containall[=false] contain not only file systems, but also
99 PID, IPC, and environment
100
101
102 --cpu-shares=-1 CPU shares for container
103
104
105 --cpus="" Number of CPUs available to container
106
107
108 --cpuset-cpus="" List of host CPUs available to container
109
110
111 --cpuset-mems="" List of host memory nodes available to container
112
113
114 --disable-cache[=false] dont use cache, and dont create cache
115
116
117 --dns="" list of DNS server separated by commas to add in re‐
118 solv.conf
119
120
121 --docker-host="" specify a custom Docker daemon host
122
123
124 --docker-login[=false] login to a Docker Repository interactively
125
126
127 --drop-caps="" a comma separated capability list to drop
128
129
130 --env=[] pass environment variable to contained process
131
132
133 --env-file="" pass environment variables from file to contained
134 process
135
136
137 -f, --fakeroot[=false] run container in new user namespace as uid
138 0
139
140
141 --fusemount=[] A FUSE filesystem mount specification of the form
142 ': ' - where is 'container' or 'host', specifying where the mount will
143 be performed ('container-daemon' or 'host-daemon' will run the FUSE
144 process detached). is the path to the FUSE executable, plus options
145 for the mount. is the location in the container to which the FUSE
146 mount will be attached. E.g. 'container:sshfs 10.0.0.1:/ /sshfs'. Im‐
147 plies --pid.
148
149
150 -h, --help[=false] help for exec
151
152
153 -H, --home="/builddir" a home directory specification. spec can
154 either be a src path or src:dest pair. src is the source path of the
155 home directory outside the container and dest overrides the home direc‐
156 tory within the container.
157
158
159 --hostname="" set container hostname. Infers --uts.
160
161
162 -i, --ipc[=false] run container in a new IPC namespace
163
164
165 --keep-privs[=false] let root user keep privileges in container
166 (root only)
167
168
169 --memory="" Memory limit in bytes
170
171
172 --memory-reservation="" Memory soft limit in bytes
173
174
175 --memory-swap="" Swap limit, use -1 for unlimited swap
176
177
178 --mount=[] a mount specification e.g. 'type=bind,source=/opt,des‐
179 tination=/hostopt'.
180
181
182 -n, --net[=false] run container in a new network namespace (sets
183 up a bridge network interface by default)
184
185
186 --network="bridge" specify desired network type separated by com‐
187 mas, each network will bring up a dedicated interface inside container
188
189
190 --network-args=[] specify network arguments to pass to CNI plugins
191
192
193 --no-eval[=false] do not shell evaluate env vars or OCI container
194 CMD/ENTRYPOINT/ARGS
195
196
197 --no-home[=false] do NOT mount users home directory if /home is
198 not the current working directory
199
200
201 --no-https[=false] use http instead of https for docker:// oras://
202 and library:///... URIs
203
204
205 --no-init[=false] do NOT start shim process with --pid
206
207
208 --no-mount=[] disable one or more 'mount xxx' options set in sin‐
209 gularity.conf, specify absolute destination path to disable a bind path
210 entry, or 'bind-paths' to disable all bind path entries.
211
212
213 --no-privs[=false] drop all privileges from root user in con‐
214 tainer)
215
216
217 --no-setgroups[=false] disable setgroups when entering --fakeroot
218 user namespace
219
220
221 --no-umask[=false] do not propagate umask to the container, set
222 default 0022 umask
223
224
225 --nv[=false] enable Nvidia support
226
227
228 --nvccli[=false] use nvidia-container-cli for GPU setup (experi‐
229 mental)
230
231
232 --oci[=false] Launch container with OCI runtime (experimental)
233
234
235 --oom-kill-disable[=false] Disable OOM killer
236
237
238 -o, --overlay=[] use an overlayFS image for persistent data stor‐
239 age or as read-only layer of container
240
241
242 --passphrase[=false] prompt for an encryption passphrase
243
244
245 --pem-path="" enter an path to a PEM formatted RSA key for an en‐
246 crypted container
247
248
249 -p, --pid[=false] run container in a new PID namespace
250
251
252 --pids-limit=0 Limit number of container PIDs, use -1 for unlim‐
253 ited
254
255
256 --pwd="" initial working directory for payload process inside the
257 container
258
259
260 --rocm[=false] enable experimental Rocm support
261
262
263 -S, --scratch=[] include a scratch directory within the container
264 that is linked to a temporary dir (use -W to force location)
265
266
267 --security=[] enable security features (SELinux, Apparmor, Sec‐
268 comp)
269
270
271 --sif-fuse[=false] attempt FUSE mount of SIF (unprivileged / user
272 namespace only) (experimental)
273
274
275 -u, --userns[=false] run container in a new user namespace, allow‐
276 ing Singularity to run completely unprivileged on recent kernels. This
277 disables some features of Singularity, for example it only works with
278 sandbox images.
279
280
281 --uts[=false] run container in a new UTS namespace
282
283
284 --vm[=false] enable VM support
285
286
287 --vm-cpu="1" number of CPU cores to allocate to Virtual Machine
288 (implies --vm)
289
290
291 --vm-err[=false] enable attaching stderr from VM
292
293
294 --vm-ip="dhcp" IP Address to assign for container usage. Defaults
295 to DHCP within bridge network.
296
297
298 --vm-ram="1024" amount of RAM in MiB to allocate to Virtual Ma‐
299 chine (implies --vm)
300
301
302 -W, --workdir="" working directory to be used for /tmp, /var/tmp
303 and $HOME (if -c/--contain was also used)
304
305
306 -w, --writable[=false] by default all Singularity containers are
307 available as read only. This option makes the file system accessible as
308 read/write.
309
310
311 --writable-tmpfs[=false] makes the file system accessible as read-
312 write with non persistent data (with overlay support only)
313
314
315
317 $ singularity exec /tmp/debian.sif cat /etc/debian_version
318 $ singularity exec /tmp/debian.sif python ./hello_world.py
319 $ cat hello_world.py | singularity exec /tmp/debian.sif python
320 $ sudo singularity exec --writable /tmp/debian.sif apt-get update
321 $ singularity exec instance://my_instance ps -ef
322 $ singularity exec library://centos cat /etc/os-release
323
324
325
326
328 singularity(1)
329
330
331
333 18-Sep-2023 Auto generated by spf13/cobra
334
335
336
337Auto generated by spf13/cobra Sep 2023 singularity(1)