Scroll to navigation

singularity(1) singularity(1)

NAME

singularity-shell - Run a shell within a container

SYNOPSIS

singularity shell [shell options...]

DESCRIPTION

singularity shell supports the following formats:

*.sif Singularity Image Format (SIF). Native to Singularity 3.0+

*.sqsh SquashFS format. Native to Singularity 2.4+

*.img ext3 format. Native to Singularity versions < 2.4.

directory/ sandbox format. Directory containing a valid root file
system and optionally Singularity meta-data.

instance://* A local running instance of a container. (See the instance
command group.)

library://* A SIF container hosted on a Library
(default https://cloud.sylabs.io/library)

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.

OPTIONS

--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. spec has the format src[:dest[:opts]], where src and dest are outside and inside paths. If dest is not given, it is set equal to src. 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.

--blkio-weight=0 Block IO relative weight in range 10-1000, 0 to 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, default will be: /etc/cdi,/var/run/cdi

-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 /dev and empty other directories (e.g. /tmp and $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.

--disable-cache[=false] dont use cache, and dont create cache

--dns="" list of DNS server separated by commas to add in resolv.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 in new user namespace as uid 0

--fusemount=[] A FUSE filesystem mount specification of the form ': ' - where is 'container' or 'host', specifying where the mount will be performed ('container-daemon' or 'host-daemon' will run the FUSE process detached). is the path to the FUSE executable, plus options for the mount. 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 shell

-H, --home="/home/abuild" a home directory specification. spec can either be a src path or src:dest pair. src is the source path of the home directory outside the container and dest overrides the home directory within the container.

--hostname="" set container hostname. Infers --uts.

-i, --ipc[=false] run container in a new IPC namespace

--keep-layers[=false] Keep layers when creating an OCI-SIF. Do not squash to a single layer.

--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 -1 for unlimited swap

--mount=[] a mount specification e.g. 'type=bind,source=/opt,destination=/hostopt'.

-n, --net[=false] run container in a new network namespace (sets up a bridge network interface by default)

--network="bridge" 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-compat=false ⟨--oci mode⟩ do not apply settings for increased OCI/Docker compatibility. Emulate native runtime defaults without --contain etc.

--no-eval[=false] do not shell evaluate env vars or OCI container CMD/ENTRYPOINT/ARGS

--no-home[=false] do NOT mount users home directory if /home is not the current working directory

--no-https[=false] use http instead of https for docker:// oras:// and library:///... URIs

--no-init[=false] do NOT start shim process with --pid

--no-mount=[] disable one or more 'mount xxx' options set in singularity.conf, specify absolute destination path to disable a bind path entry, or 'bind-paths' to disable all bind path entries.

--no-oci[=false] Launch container with native runtime

--no-pid[=false] do not run container in a new PID namespace

--no-privs[=false] drop all privileges in container (root only in non-OCI mode)

--no-setgroups[=false] disable setgroups when entering --fakeroot user namespace

--no-tmp-sandbox[=false] Prohibits unpacking of images into temporary sandbox dirs

--no-umask[=false] do not propagate umask to the container, set default 0022 umask

--nv[=false] enable Nvidia support

--nvccli[=false] use nvidia-container-cli for GPU setup (experimental)

--oci[=false] Launch container with OCI runtime (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 -1 for unlimited

--rocm[=false] enable experimental Rocm support

-S, --scratch=[] include a scratch directory within the container that is linked to a temporary dir (use -W to force location)

--security=[] enable security features (SELinux, Apparmor, Seccomp)

-s, --shell="" path to program to use for interactive shell

--tmp-sandbox[=false] Forces unpacking of images into temporary sandbox dirs when a kernel or FUSE mount would otherwise be used.

-u, --userns[=false] run container in a new user namespace, allowing Singularity to run completely unprivileged on recent kernels. This disables some features of Singularity, for example it only works with sandbox images.

--uts[=false] run container in a new UTS namespace

-W, --workdir="" working directory to be used for /tmp and /var/tmp (if -c/--contain was also used)

-w, --writable[=false] by default all Singularity 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


$ singularity shell /tmp/Debian.sif
Singularity/Debian.sif> pwd
/home/gmk/test
Singularity/Debian.sif> exit
$ singularity shell -C /tmp/Debian.sif
Singularity/Debian.sif> pwd
/home/gmk
Singularity/Debian.sif> ls -l
total 0
Singularity/Debian.sif> exit
$ sudo singularity shell -w /tmp/Debian.sif
$ sudo singularity shell --writable /tmp/Debian.sif
$ singularity shell instance://my_instance
$ singularity shell instance://my_instance
Singularity: Invoking an interactive shell within container...
Singularity container:~> ps -ef
UID PID PPID C STIME TTY TIME CMD
ubuntu 1 0 0 20:00 ? 00:00:00 /usr/local/bin/singularity/bin/sinit
ubuntu 2 0 0 20:01 pts/8 00:00:00 /bin/bash --norc
ubuntu 3 2 0 20:02 pts/8 00:00:00 ps -ef

SEE ALSO

singularity(1)

HISTORY

15-May-2024 Auto generated by spf13/cobra

May 2024 Auto generated by spf13/cobra