Documentation ¶
Overview ¶
Package launcher is responsible for starting a container, with configuration passed to it from the CLI layer.
The package currently implements a single Launcher, with an Exec method that constructs a runtime configuration and calls the Apptainer runtime starter binary to start the container.
TODO - the launcher package will be extended to support launching containers via the OCI runc/crun runtime, in addition to the current Apptainer runtime starter.
Index ¶
- type Launcher
- type Namespaces
- type Option
- func OptAllowSUID(b bool) Option
- func OptAppName(a string) Option
- func OptBoot(b bool) Option
- func OptCacheDisabled(b bool) Option
- func OptCaps(add, drop string) Option
- func OptCgroupsJSON(cj string) Option
- func OptConfigFile(c string) Option
- func OptContain(b bool) Option
- func OptContainAll(b bool) Option
- func OptContainLibs(cl []string) Option
- func OptCwdPath(p string) Option
- func OptDMTCPLaunch(a string) Option
- func OptDMTCPRestart(a string) Option
- func OptDNS(d string) Option
- func OptEnv(env map[string]string, envFile string, clean bool) Option
- func OptFakeroot(b bool) Option
- func OptHome(homeDir string, custom bool, disable bool) Option
- func OptHostname(h string) Option
- func OptIgnoreFakerootCmd(b bool) Option
- func OptIgnoreSubuid(b bool) Option
- func OptIgnoreUserns(b bool) Option
- func OptKeepPrivs(b bool) Option
- func OptKeyInfo(ki *cryptkey.KeyInfo) Option
- func OptMounts(binds []string, mounts []string, fuseMounts []string) Option
- func OptNamespaces(n Namespaces) Option
- func OptNetwork(network string, args []string) Option
- func OptNoEval(b bool) Option
- func OptNoInit(b bool) Option
- func OptNoMount(nm []string) Option
- func OptNoNvidia(b bool) Option
- func OptNoPrivs(b bool) Option
- func OptNoRocm(b bool) Option
- func OptNoUmask(b bool) Option
- func OptNvidia(nv bool, nvccli bool) Option
- func OptOverlayPaths(op []string) Option
- func OptRocm(b bool) Option
- func OptScratchDirs(sd []string) Option
- func OptSecurity(s []string) Option
- func OptShareNSFd(fd int) Option
- func OptShareNSMode(b bool) Option
- func OptShellPath(s string) Option
- func OptTmpDir(a string) Option
- func OptUnderlay(b bool) Option
- func OptUnsquash(b bool) Option
- func OptUseBuildConfig(b bool) Option
- func OptWorkDir(wd string) Option
- func OptWritable(b bool) Option
- func OptWritableTmpfs(b bool) Option
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Launcher ¶
type Launcher struct {
// contains filtered or unexported fields
}
func NewLauncher ¶
func (*Launcher) Exec ¶
func (l *Launcher) Exec(ctx context.Context, image string, args []string, instanceName string) error
Exec prepares an EngineConfig defining how a container should be launched, then calls the starter binary to execute it. This includes interactive containers, instances, and joining an existing instance.
func (*Launcher) SetCheckpointConfig ¶
SetCheckpointConfig sets EngineConfig entries to bind the provided list of libs and bins.
func (*Launcher) SetGPUConfig ¶
SetGPUConfig sets up EngineConfig entries for NV / ROCm usage, if requested.
type Namespaces ¶
type Namespaces struct { User bool UTS bool PID bool IPC bool Net bool // NoPID will force the PID namespace not to be used, even if set by default / other flags. NoPID bool }
Namespaces holds flags for the optional (non-mount) namespaces that can be requested for a container launch.
type Option ¶
type Option func(co *launchOptions) error
func OptAllowSUID ¶
OptAllowSUID permits setuid executables inside a container started by the root user.
func OptCacheDisabled ¶
CacheDisabled indicates caching of images was disabled in the CLI.
func OptCgroupsJSON ¶
OptCgroupsJSON sets a Cgroups resource limit configuration to apply to the container.
func OptConfigFile ¶
OptConfigFile specifies an alternate apptainer.conf that will be used by unprivileged installations only.
func OptContain ¶
OptContain starts the container with minimal /dev and empty home/tmp mounts.
func OptContainAll ¶
OptContainAll infers Contain, and adds PID, IPC namespaces, and CleanEnv.
func OptContainLibs ¶
OptContainLibs mounts specified libraries into the container .singularity.d/libs dir.
func OptCwdPath ¶ added in v1.3.0
OptCwdPath specifies the initial working directory in the container.
func OptEnv ¶
OptEnv sets container environment
envFile is a path to a file container environment variables to set. env is a map of name=value env vars to set. clean removes host variables from the container environment.
func OptFakeroot ¶
OptFakeroot enables the fake root mode, using user namespaces and subuid / subgid mapping.
func OptHome ¶
OptHome sets the home directory configuration for the container.
homeDir is the path or src:dst to bind mount. custom is a marker that this is user supplied, and must not be overridden. disable will disable the home mount entirely, ignoring other options.
func OptHostname ¶
OptHostname sets a hostname for the container (infers/requires UTS namespace).
func OptKeepPrivs ¶
OptKeepPrivs keeps all privileges inside a container started by the root user.
func OptKeyInfo ¶
OptKeyInfo sets encryption key material to use when accessing an encrypted container image.
func OptMounts ¶
OptMounts sets user-requested mounts to propagate into the container.
binds lists bind mount specifications in Apptainer's <src>:<dst>[:<opts>] format. mounts lists bind mount specifications in Docker CSV processed format. fuseMounts list FUSE mounts in <type>:<fuse command> <mountpoint> format.
func OptNamespaces ¶
func OptNamespaces(n Namespaces) Option
OptNamespaces enable the individual kernel-support namespaces for the container.
func OptNetwork ¶
OptNetwork enables CNI networking.
network is the name of the CNI configuration to enable. args are arguments to pass to the CNI plugin.
func OptNoMount ¶
OptNoMount disables the specified bind mounts.
func OptNoNvidia ¶
OptNoNvidia disables NVIDIA GPU support, even if enabled via apptainer.conf.
func OptNoPrivs ¶
OptNoPrivs drops all privileges inside a container.
func OptNoUmask ¶
OptNoUmask disables propagation of the host umask into the container, using a default 0022.
func OptNvidia ¶
OptNvidia enables NVIDIA GPU support.
nvccli sets whether to use the nvidia-container-runtime (true), or legacy bind mounts (false).
func OptOverlayPaths ¶
OptOverlayPaths sets overlay images and directories to apply to the container.
func OptScratchDirs ¶
OptScratchDirs sets temporary host directories to create and bind into the container.
func OptSecurity ¶
OptSecurity supplies a list of security options (selinux, apparmor, seccomp) to apply.
func OptShellPath ¶
OptShellPath specifies a custom shell executable to be launched in the container.
func OptWorkDir ¶
OptWorkDir sets the parent path for scratch directories, and contained home/tmp on the host.
func OptWritable ¶
OptWritable sets the container image to be writable.
func OptWritableTmpfs ¶
OptWritableTmpFs applies an ephemeral writable overlay to the container.