apptainer(1)
πΈ NAME πΈ
apptainer-exec β Run a command within a container.
okay bestie, this is the apptainer(1) page β the header says apptainer(1), but the command living here is apptainer-exec, and its whole vibe is running a command inside a container. periodt. π
β¨ SYNOPSIS β¨
short and sweet:
apptainer exec [exec options...]
π¦ DESCRIPTION π¦
so apptainer exec supports the following formats, and yes every single one is invited to the group chat:
.sifβ Singularity Image Format (SIF). Native to Singularity 3.0+ and all Apptainer versions. iconic. π.sqshβ SquashFS format. Native to Singularity 2.4+ and < 3.0..imgβ ext3 format. Native to Singularity versions < 2.4.directory/β sandbox format. A directory containing a valid root file system and optionally Apptainer meta-data. πinstance://β a local running instance of a container. See the instance command group.library://β a SIF container hosted on a Library (no library enabled by default).docker://β a Docker/OCI container hosted on Docker Hub or another OCI registry. π³shub://β a container hosted on Singularity Hub.oras://β a SIF container hosted on an OCI registry that supports the OCI Registry As Storage (ORAS) specification.ipfs://β a SIF image from an IPFS cluster, using a HTTP gateway.
π OPTIONS π
bestie, grab a snack β there are a LOT of flags, and I'm not skipping a single one. every default, every value, every root-only warning is staying right here. no cap. π
--add-caps=""β a comma separated capability list to add.--allow-setuid[=false]β allow setuid binaries in container (root only).--app=""β set an application to run inside a container.--apply-cgroups=""β apply cgroups from file for container processes (root only).--authfile=""β Docker-style authentication file to use for writing/reading OCI registry credentials.-B,--bind=[]β a user-bind path specification.spechas the formatsrc[:dest[:opts]], wheresrcanddestare outside and inside paths. Ifdestis not given, it is set equal tosrc. Mount options ('opts') may be specified as'ro'(read-only) or'rw'(read/write, which is the default). Multiple bind paths can be given by a comma separated list. this one is lowkey everywhere, learn it.--blkio-weight=0β Block IO relative weight in range10-1000,0to disable.--blkio-weight-device=[]β Device specific block IO relative weight.--cdi-dirs=[]β comma-separated list of directories in which CDI should look for device definition JSON files. If omitted and not set inapptainer.conf, default will be:/etc/cdi,/var/run/cdi. Not allowed in suid mode by non-root users.-e,--cleanenv[=false]β clean environment before running container.--compat[=false]β apply settings for increased OCI/Docker compatibility. Infers--containall,--no-init,--no-umask,--no-eval,--writable-tmpfs.-c,--contain[=false]β use minimal/devand empty other directories (e.g./tmpand$HOME) instead of sharing filesystems from your host.-C,--containall[=false]β contain not only file systems, but also PID, IPC, and environment.--cpu-shares=-1β CPU shares for container.--cpus=""β Number of CPUs available to container.--cpuset-cpus=""β List of host CPUs available to container.--cpuset-mems=""β List of host memory nodes available to container.--cwd=""β initial working directory for payload process inside the container (synonym for--pwd).--device=[]β fully-qualified CDI device name(s). A fully-qualified CDI device name consists of a VENDOR, CLASS, and NAME, which are combined as follows:/=, e.g.vendor.com/device=mydevice. Multiple fully-qualified CDI device names can be given as a comma separated list. CDI device girlies rise.--disable-cache[=false]β do not use or create cache.--dns=""β list of DNS server separated by commas to add inresolv.conf.--docker-host=""β specify a custom Docker daemon host.--docker-login[=false]β login to a Docker Repository interactively.--drop-caps=""β a comma separated capability list to drop.--env=[]β pass environment variable to contained process.--env-file=[]β pass environment variables from file to contained process.-f,--fakeroot[=false]β run container with the appearance of running as root.--fusemount=[]β a FUSE filesystem mount specification of the form':'β where the slot is'container'or'host', specifying where the mount will be performed ('container-daemon'or'host-daemon'will run the FUSE process detached). The next slot is the path to the FUSE executable, plus options for the mount. The next slot is the location in the container to which the FUSE mount will be attached. E.g.'container:sshfs 10.0.0.1:/ /sshfs'. Implies--pid.-h,--help[=false]β help for exec.-H,--home="/builddir"β a home directory specification.speccan either be asrcpath orsrc:destpair.srcis the source path of the home directory outside the container anddestoverrides the home directory within the container.--hostname=""β set container hostname.--intel-hpu[=false]β enable Intel(R) Gaudi accelerator support while using a minimal/dev.-i,--ipc[=false]β run container in a new IPC namespace.--keep-privs[=false]β let root user keep privileges in container (root only).--memory=""β Memory limit in bytes.--memory-reservation=""β Memory soft limit in bytes.--memory-swap=""β Swap limit, use-1for unlimited swap.--mount=[]β a mount specification e.g.'type=bind,src=/opt,dst=/hostopt'.-n,--net[=false]β run container in a new network namespace (sets up a bridge network interface by default).--netns-path=""β join the network namespace at the specified path (as root, or if permitted inapptainer.conf).--network=""β specify desired network type separated by commas, each network will bring up a dedicated interface inside container.--network-args=[]β specify network arguments to pass to CNI plugins.--no-env=[]β list of environment variables to block from import into container from host environment.--no-eval[=false]β do not shell evaluate env vars or OCI containerCMD/ENTRYPOINT/ARGS.--no-home[=false]β do NOT mount users home directory if/homeis not the current working directory.--no-https[=false]β usehttpinstead ofhttpsfordocker://oras://andlibrary:///...URIs.--no-init[=false]β do NOT start shim process with--pid.--no-mount=[]β disable one or more'mount xxx'options set inapptainer.confand/or specify absolute destination path to disable a bind path entry, or'bind-paths'to disable all bind path entries.--no-pid[=false]β do not run container in a new PID namespace.--no-privs[=false]β drop all privileges from root user in container.--no-umask[=false]β do not propagate umask to the container, set default0022umask.--nv[=false]β enable Nvidia support.--nvccli[=false]β usenvidia-container-clifor GPU setup (experimental).--oom-kill-disable[=false]β Disable OOM killer.-o,--overlay=[]β use an overlayFS image for persistent data storage or as read-only layer of container.--passphrase[=false]β prompt for an encryption passphrase.--pem-path=""β enter an path to a PEM formatted RSA key for an encrypted container.-p,--pid[=false]β run container in a new PID namespace.--pids-limit=0β Limit number of container PIDs, use-1for unlimited.--rocm[=false]β enable experimental Rocm support.-S,--scratch=[]β include a scratch directory within the container that is linked to a temporary dir (use-Wto force location).--security=[]β enable security features (SELinux, Apparmor, Seccomp).--sharens[=false]β share the namespace and image with other containers launched from the same parent process.--unsquash[=false]β Convert SIF file to temporary sandbox before running.-u,--userns[=false]β run container in a new user namespace.--uts[=false]β run container in a new UTS namespace.-W,--workdir=""β working directory to be used for/tmp,/var/tmpand$HOME(if-c/--containwas also used).-w,--writable[=false]β by default all Apptainer containers are available as read only. This option makes the file system accessible as read/write.--writable-tmpfs[=false]β makes the file system accessible as read-write with non persistent data (with overlay support only).
π EXAMPLE π
okay bestie, here are the literal examples, copy-paste energy:
$ apptainer exec /tmp/debian.sif cat /etc/debian_version
$ apptainer exec /tmp/debian.sif python ./hello_world.py
$ cat hello_world.py | apptainer exec /tmp/debian.sif python
$ sudo apptainer exec --writable /tmp/debian.sif apt-get update
$ apptainer exec instance://my_instance ps -ef
$ apptainer exec library://centos cat /etc/os-release
π SEE ALSO π
apptainer(1)β the mothership manual, go read it bestie.
π°οΈ HISTORY π°οΈ
22-Oct-2026 Auto generated by spf13/cobra
mwah π that's the whole page. it's auto-generated by spf13/cobra, dated Oct 2026, and it's the apptainer(1) manual β now go run something iconic. π«Ά
π¦ where this page comes from
- epel 9: apptainer 1.5.5-1.el9 Β· Apache-2.0 AND BSD-2-Clause AND BSD-3-Clause AND BSD-3-Clause-LBNL AND ISC AND MIT AND MPL-2.0 AND Unlicense
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms