1apptainer(1)                                                      apptainer(1)
2
3
4

NAME

6       apptainer-exec - Run a command within a container
7
8
9

SYNOPSIS

11       apptainer exec [exec options...]
12
13
14

DESCRIPTION

16       apptainer exec supports the following formats:
17
18
19       *.sif               Singularity Image Format (SIF). Native to Singular‐
20       ity (3.0+) and Apptainer (v1.0.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 Apptainer 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 (no default)
40
41
42       docker://*          A Docker/OCI container hosted on Docker Hub or  an‐
43       other
44                             OCI registry.
45
46
47       shub://*            A container hosted on Singularity Hub.
48
49
50       oras://*            A SIF container hosted on an OCI registry that sup‐
51       ports
52                             the OCI Registry As Storage (ORAS) specification.
53
54
55

OPTIONS

57       --add-caps=""      a comma separated capability list to add
58
59
60       --allow-setuid[=false]      allow setuid binaries  in  container  (root
61       only)
62
63
64       --app=""      set an application to run inside a container
65
66
67       --apply-cgroups=""      apply cgroups from file for container processes
68       (root only)
69
70
71       -B, --bind=[]      a user-bind path specification.  spec has the format
72       src[:dest[:opts]], where src and dest are outside and inside paths.  If
73       dest is not given, it is set equal to src.  Mount options ('opts')  may
74       be  specified as 'ro' (read-only) or 'rw' (read/write, which is the de‐
75       fault). Multiple bind paths can be given by a comma separated list.
76
77
78       -e, --cleanenv[=false]      clean environment before running container
79
80
81       --compat[=false]      apply settings for increased OCI/Docker  compati‐
82       bility. Infers --containall, --no-init, --no-umask, --writable-tmpfs.
83
84
85       -c, --contain[=false]      use minimal /dev and empty other directories
86       (e.g. /tmp and $HOME) instead of sharing filesystems from your host
87
88
89       -C, --containall[=false]      contain not only file systems,  but  also
90       PID, IPC, and environment
91
92
93       --disable-cache[=false]      dont use cache, and dont create cache
94
95
96       --dns=""       list  of  DNS  server  separated by commas to add in re‐
97       solv.conf
98
99
100       --docker-login[=false]      login to a Docker Repository interactively
101
102
103       --drop-caps=""      a comma separated capability list to drop
104
105
106       --env=[]      pass environment variable to contained process
107
108
109       --env-file=""      pass environment variables from  file  to  contained
110       process
111
112
113       -f,  --fakeroot[=false]      run container in new user namespace as uid
114       0
115
116
117       --fusemount=[]      A FUSE filesystem mount specification of  the  form
118       ': ' - where  is 'container' or 'host', specifying where the mount will
119       be performed ('container-daemon' or 'host-daemon'  will  run  the  FUSE
120       process  detached).   is  the path to the FUSE executable, plus options
121       for the mount.  is the location in the  container  to  which  the  FUSE
122       mount  will  be attached. E.g. 'container:sshfs 10.0.0.1:/ /sshfs'. Im‐
123       plies --pid.
124
125
126       -h, --help[=false]      help for exec
127
128
129       -H, --home="/builddir"      a home directory specification.   spec  can
130       either  be  a src path or src:dest pair.  src is the source path of the
131       home directory outside the container and dest overrides the home direc‐
132       tory within the container.
133
134
135       --hostname=""      set container hostname
136
137
138       -i, --ipc[=false]      run container in a new IPC namespace
139
140
141       --keep-privs[=false]       let  root  user keep privileges in container
142       (root only)
143
144
145       --mount=[]      a mount specification e.g.  'type=bind,source=/opt,des‐
146       tination=/hostopt'.
147
148
149       -n,  --net[=false]       run container in a new network namespace (sets
150       up a bridge network interface by default)
151
152
153       --network="bridge"      specify desired network type separated by  com‐
154       mas, each network will bring up a dedicated interface inside container
155
156
157       --network-args=[]      specify network arguments to pass to CNI plugins
158
159
160       --no-home[=false]       do  NOT  mount users home directory if /home is
161       not the current working directory
162
163
164       --no-https[=false]      use http instead of https for docker:// oras://
165       and library:///... URIs
166
167
168       --no-init[=false]      do NOT start shim process with --pid
169
170
171       --no-mount=[]       disable  one  or more mount xxx options set in app‐
172       tainer.conf
173
174
175       --no-privs[=false]      drop all privileges  from  root  user  in  con‐
176       tainer)
177
178
179       --no-umask[=false]       do  not  propagate umask to the container, set
180       default 0022 umask
181
182
183       --nv[=false]      enable Nvidia support
184
185
186       --nvccli[=false]      use nvidia-container-cli for GPU  setup  (experi‐
187       mental)
188
189
190       -o,  --overlay=[]      use an overlayFS image for persistent data stor‐
191       age or as read-only layer of container
192
193
194       --passphrase[=false]      prompt for an encryption passphrase
195
196
197       --pem-path=""      enter an path to a PEM formatted RSA key for an  en‐
198       crypted container
199
200
201       -p, --pid[=false]      run container in a new PID namespace
202
203
204       --pwd=""       initial working directory for payload process inside the
205       container
206
207
208       --rocm[=false]      enable experimental Rocm support
209
210
211       -S, --scratch=[]      include a scratch directory within the  container
212       that is linked to a temporary dir (use -W to force location)
213
214
215       --security=[]       enable  security  features (SELinux, Apparmor, Sec‐
216       comp)
217
218
219       -u, --userns[=false]      run container in a new user namespace, allow‐
220       ing  Apptainer  to  run completely unprivileged on recent kernels. This
221       disables some features of Apptainer, for example  it  only  works  with
222       sandbox images.
223
224
225       --uts[=false]      run container in a new UTS namespace
226
227
228       --vm[=false]      enable VM support
229
230
231       --vm-cpu="1"       number  of  CPU cores to allocate to Virtual Machine
232       (implies --vm)
233
234
235       --vm-err[=false]      enable attaching stderr from VM
236
237
238       --vm-ip="dhcp"      IP Address to assign for container usage.  Defaults
239       to DHCP within bridge network.
240
241
242       --vm-ram="1024"       amount  of  RAM in MiB to allocate to Virtual Ma‐
243       chine (implies --vm)
244
245
246       -W, --workdir=""      working directory to be used for  /tmp,  /var/tmp
247       and $HOME (if -c/--contain was also used)
248
249
250       -w,  --writable[=false]       by  default  all Apptainer containers are
251       available as read only. This option makes the file system accessible as
252       read/write.
253
254
255       --writable-tmpfs[=false]      makes the file system accessible as read-
256       write with non persistent data (with overlay support only)
257
258
259

EXAMPLE

261                $ apptainer exec /tmp/debian.sif cat /etc/debian_version
262                $ apptainer exec /tmp/debian.sif python ./hello_world.py
263                $ cat hello_world.py | apptainer exec /tmp/debian.sif python
264                $ sudo apptainer exec --writable /tmp/debian.sif apt-get update
265                $ apptainer exec instance://my_instance ps -ef
266                $ apptainer exec library://centos cat /etc/os-release
267
268
269
270

SEE ALSO

272       apptainer(1)
273
274
275

HISTORY

277       22-Jun-2022 Auto generated by spf13/cobra
278
279
280
281Auto generated by spf13/cobra      Jun 2022                       apptainer(1)
Impressum