apptainer

package
v1.3.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Apr 24, 2024 License: BSD-3-Clause Imports: 8 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// DefaultLayer is the string representation for the default layer.
	DefaultLayer string = "none"
	// OverlayLayer is the string representation for the overlay layer.
	OverlayLayer = "overlay"
	// UnderlayLayer is the string representation for the underlay layer.
	UnderlayLayer = "underlay"
)
View Source
const Name = "apptainer"

Name is the name of the runtime.

Variables

This section is empty.

Functions

func ConcatenateSliceDeduplicate added in v1.2.3

func ConcatenateSliceDeduplicate(first []string, second []string) []string

ConcatenateSliceDeduplicate concatenates two string slices and returns a string slice without duplicated entries.

Types

type BindOption

type BindOption struct {
	Value string `json:"value,omitempty"`
}

BindOption represents a bind option with its associated value if any.

type BindPath

type BindPath struct {
	Source      string                 `json:"source"`
	Destination string                 `json:"destination"`
	Options     map[string]*BindOption `json:"options"`
}

BindPath stores a parsed bind path specification. Source and Destination paths are required.

func ParseBindPath

func ParseBindPath(paths []string) ([]BindPath, error)

ParseBindPath parses a an array of strings each specifying one or more (comma separated) bind paths in src[:dst[:options]] format, and returns all encountered bind paths as a slice. Options may be simple flags, e.g. 'rw', or take a value, e.g. 'id=2'.

func ParseMountString

func ParseMountString(mount string) (bindPaths []BindPath, err error)

ParseMountString converts a --mount string into one or more BindPath structs.

Our intention is to support common docker --mount strings, but have additional fields for apptainer specific concepts (image-src, id when binding out of an image file).

We use a CSV reader to parse the fields in a mount string according to CSV escaping rules. This is the approach docker uses to allow special characters in source / dest etc., and we wish to be as compatible as possible. It also allows us to handle multiple newline separated mounts, which is convenient for specifying multiple mounts in a single env var.

The fields are in key[=value] format. Flag options have no value, e.g.:

type=bind,source=/opt,destination=/other,rw

We only support type=bind at present, so assume this if type is missing and error for other types.

func (*BindPath) ID

func (b *BindPath) ID() string

ID returns the value of the option id for a BindPath, or an empty string if the option wasn't set.

func (*BindPath) ImageSrc

func (b *BindPath) ImageSrc() string

ImageSrc returns the value of the option image-src for a BindPath, or an empty string if the option wasn't set.

func (*BindPath) Readonly

func (b *BindPath) Readonly() bool

Readonly returns true if the ro option was set for a BindPath.

type DMTCPConfig added in v1.0.0

type DMTCPConfig struct {
	Enabled    bool     `json:"enabled,omitempty"`
	Restart    bool     `json:"restart,omitempty"`
	Checkpoint string   `json:"checkpoint,omitempty"`
	Args       []string `json:"args,omitempty"`
}

DMTCPConfig stores the DMTCP-related information required for container process checkpoint/restart behavior.

type EngineConfig

type EngineConfig struct {
	JSON      *JSONConfig         `json:"jsonConfig"`
	OciConfig *oci.Config         `json:"ociConfig"`
	File      *apptainerconf.File `json:"fileConfig"`
}

EngineConfig stores the JSONConfig, the OciConfig and the File configuration.

func NewConfig

func NewConfig() *EngineConfig

NewConfig returns apptainer.EngineConfig.

func (*EngineConfig) AppendFilesPath

func (e *EngineConfig) AppendFilesPath(files ...string)

AppendFilesPath adds files to bind in container (eg: --nv)

func (*EngineConfig) AppendLibrariesPath

func (e *EngineConfig) AppendLibrariesPath(libraries ...string)

AppendLibrariesPath adds libraries to bind in container /.singularity.d/libs directory.

func (*EngineConfig) GetAddCaps

func (e *EngineConfig) GetAddCaps() string

GetAddCaps retrieves bounding/effective/permitted/inheritable/ambient capabilities to add.

func (*EngineConfig) GetAllowSUID

func (e *EngineConfig) GetAllowSUID() bool

GetAllowSUID returns true if allow-suid is set and false if not.

func (*EngineConfig) GetApptainerEnv

func (e *EngineConfig) GetApptainerEnv() map[string]string

GetApptainerEnv returns apptainer environment variables as a key/value string map.

func (*EngineConfig) GetBindPath

func (e *EngineConfig) GetBindPath() []BindPath

GetBindPath retrieves the bind paths.

func (*EngineConfig) GetBootInstance

func (e *EngineConfig) GetBootInstance() bool

GetBootInstance returns if boot flag is set or not

func (*EngineConfig) GetCgroupsJSON added in v1.1.0

func (e *EngineConfig) GetCgroupsJSON() string

GetCgroupsTOML returns cgroups configuration to apply.

func (*EngineConfig) GetCommand

func (e *EngineConfig) GetCommand() string

GetCommand retrieves action command.

func (*EngineConfig) GetConfigDir added in v1.2.3

func (e *EngineConfig) GetConfigDir() string

GetConfigDir retrieves the config directory path if it is set, or otherwise an empty string.

func (*EngineConfig) GetConfigurationFile

func (e *EngineConfig) GetConfigurationFile() string

GetConfigurationFile returns the apptainer configuration file to use.

func (*EngineConfig) GetContain

func (e *EngineConfig) GetContain() bool

GetContain returns if contain flag is set or not.

func (*EngineConfig) GetCustomHome

func (e *EngineConfig) GetCustomHome() bool

GetCustomHome retrieves if home path is a custom path.

func (*EngineConfig) GetCwd

func (e *EngineConfig) GetCwd() string

GetCwd returns current working directory.

func (*EngineConfig) GetDMTCPConfig added in v1.0.0

func (e *EngineConfig) GetDMTCPConfig() DMTCPConfig

GetDMTCPConfig returns the dmtcp configuration to be used for the container process.

func (*EngineConfig) GetDNS

func (e *EngineConfig) GetDNS() string

GetDNS retrieves list of DNS servers.

func (*EngineConfig) GetDbusSessionBusAddress added in v1.1.0

func (e *EngineConfig) GetDbusSessionBusAddress() string

GetDbusSessionBusAddress gets the DBUS_SESSION_BUS_ADDRESS value for rootless operations

func (*EngineConfig) GetDeleteTempDir

func (e *EngineConfig) GetDeleteTempDir() string

GetDeleteTempDir returns the path of the temporary directory containing the root filesystem which must be deleted after use. If no deletion is required, the empty string is returned.

func (*EngineConfig) GetDropCaps

func (e *EngineConfig) GetDropCaps() string

GetDropCaps retrieves bounding/effective/permitted/inheritable/ambient capabilities to drop.

func (*EngineConfig) GetEncryptionKey

func (e *EngineConfig) GetEncryptionKey() []byte

GetEncryptionKey retrieves the key for image's system partition.

func (*EngineConfig) GetFakeroot

func (e *EngineConfig) GetFakeroot() bool

GetFakeroot returns if fakeroot is set or not.

func (*EngineConfig) GetFakerootPath added in v1.1.0

func (e *EngineConfig) GetFakerootPath() string

GetFakerootPath retrieves the fakeroot path

func (*EngineConfig) GetFilesPath

func (e *EngineConfig) GetFilesPath() []string

GetFilesPath returns files to bind in container (eg: --nv).

func (*EngineConfig) GetFuseMount

func (e *EngineConfig) GetFuseMount() []FuseMount

GetFuseMount returns the list of fuse mount after processing by SetFuseMount.

func (*EngineConfig) GetHomeDest

func (e *EngineConfig) GetHomeDest() string

GetHomeDest retrieves the container home directory path.

func (*EngineConfig) GetHomeSource

func (e *EngineConfig) GetHomeSource() string

GetHomeSource retrieves the source home directory path.

func (*EngineConfig) GetHostname

func (e *EngineConfig) GetHostname() string

GetHostname retrieves hostname to use in containee.JSON.

func (*EngineConfig) GetImage

func (e *EngineConfig) GetImage() string

GetImage retrieves the container image path.

func (*EngineConfig) GetImageArg

func (e *EngineConfig) GetImageArg() string

GetImageArg retrieves the container image argument.

func (*EngineConfig) GetImageList

func (e *EngineConfig) GetImageList() []image.Image

GetImageList returns image list containing opened images.

func (*EngineConfig) GetInstance

func (e *EngineConfig) GetInstance() bool

GetInstance returns if container run as instance or not.

func (*EngineConfig) GetInstanceJoin

func (e *EngineConfig) GetInstanceJoin() bool

GetInstanceJoin returns if process joins an instance or not.

func (*EngineConfig) GetKeepPrivs

func (e *EngineConfig) GetKeepPrivs() bool

GetKeepPrivs returns if keep-privs is set or not.

func (*EngineConfig) GetLibrariesPath

func (e *EngineConfig) GetLibrariesPath() []string

GetLibrariesPath returns libraries to bind in container /.singularity.d/libs directory.

func (*EngineConfig) GetNetwork

func (e *EngineConfig) GetNetwork() string

GetNetwork retrieves a list of commas separated networks configured in container.

func (*EngineConfig) GetNetworkArgs

func (e *EngineConfig) GetNetworkArgs() []string

GetNetworkArgs retrieves network arguments passed to CNI plugins.

func (*EngineConfig) GetNoCwd

func (e *EngineConfig) GetNoCwd() bool

GetNoCwd returns if no-cwd flag is set or not.

func (*EngineConfig) GetNoDev

func (e *EngineConfig) GetNoDev() bool

GetNoDev returns if no-dev flag is set or not.

func (*EngineConfig) GetNoDevPts

func (e *EngineConfig) GetNoDevPts() bool

GetNoDevPts returns if no-devpts flag is set or not.

func (*EngineConfig) GetNoEval added in v1.1.0

func (e *EngineConfig) GetNoEval() bool

GetNoEval sets whether to avoid a shell eval on APPTAINERENV_ and in runscripts generated from OCI containers CMD/ENTRYPOINT.

func (*EngineConfig) GetNoHome

func (e *EngineConfig) GetNoHome() bool

GetNoHome returns if no-home flag is set or not.

func (*EngineConfig) GetNoHostfs

func (e *EngineConfig) GetNoHostfs() bool

GetNoHostfs returns if no-hostfs flag is set or not.

func (*EngineConfig) GetNoInit

func (e *EngineConfig) GetNoInit() bool

GetNoInit returns if noinit flag is set or not.

func (*EngineConfig) GetNoPrivs

func (e *EngineConfig) GetNoPrivs() bool

GetNoPrivs returns if no-privs flag is set or not.

func (*EngineConfig) GetNoProc

func (e *EngineConfig) GetNoProc() bool

GetNoProc returns if no-proc flag is set or not.

func (*EngineConfig) GetNoSys

func (e *EngineConfig) GetNoSys() bool

GetNoSys returns if no-sys flag is set or not.

func (*EngineConfig) GetNoTmp

func (e *EngineConfig) GetNoTmp() bool

GetNoTmp returns if no-tmo flag is set or not.

func (*EngineConfig) GetNvCCLI

func (e *EngineConfig) GetNvCCLI() bool

GetNvCCLI returns if NvCCLI flag is set or not.

func (*EngineConfig) GetNvCCLIEnv

func (e *EngineConfig) GetNvCCLIEnv() []string

GetNvCCLIEnv returns env vars holding options for nvidia-container-cli GPU setup

func (*EngineConfig) GetNvLegacy

func (e *EngineConfig) GetNvLegacy() bool

GetNvLegacy returns if nv flag is set or not.

func (*EngineConfig) GetOpenFd

func (e *EngineConfig) GetOpenFd() []int

GetOpenFd returns the list of open file descriptor.

func (*EngineConfig) GetOverlayImage

func (e *EngineConfig) GetOverlayImage() []string

GetOverlayImage retrieves the overlay image path.

func (*EngineConfig) GetRestoreUmask

func (e *EngineConfig) GetRestoreUmask() bool

GetRestoreUmask returns the umask to be used in the container launched process.

func (*EngineConfig) GetRocm

func (e *EngineConfig) GetRocm() bool

GetRocm returns if rocm flag is set or not.

func (*EngineConfig) GetRunscriptTimeout added in v1.3.1

func (e *EngineConfig) GetRunscriptTimeout() string

GetRunscriptTimeout gets the set runscript timeout

func (*EngineConfig) GetScratchDir

func (e *EngineConfig) GetScratchDir() []string

GetScratchDir retrieves the scratch directory path.

func (*EngineConfig) GetSecurity

func (e *EngineConfig) GetSecurity() []string

GetSecurity returns security feature arguments.

func (*EngineConfig) GetSessionLayer

func (e *EngineConfig) GetSessionLayer() string

GetSessionLayer returns the session layer used to setup the container mount points.

func (*EngineConfig) GetShareNSFd added in v1.3.0

func (e *EngineConfig) GetShareNSFd() int

GetShareNSFd gets the locked fd

func (*EngineConfig) GetShareNSMode added in v1.3.0

func (e *EngineConfig) GetShareNSMode() bool

GetShareNSMode gets the value of previous SetShareNSMode

func (*EngineConfig) GetShell

func (e *EngineConfig) GetShell() string

GetShell retrieves shell for shell command.

func (*EngineConfig) GetSignalPropagation

func (e *EngineConfig) GetSignalPropagation() bool

GetSignalPropagation returns if engine propagate signals across processes (see SetSignalPropagation).

func (*EngineConfig) GetSkipBinds added in v1.1.0

func (e *EngineConfig) GetSkipBinds() []string

GetSkipBinds gets bind paths to skip

func (*EngineConfig) GetTargetGID

func (e *EngineConfig) GetTargetGID() []int

GetTargetGID returns the target GIDs.

func (*EngineConfig) GetTargetUID

func (e *EngineConfig) GetTargetUID() int

GetTargetUID returns the target UID.

func (*EngineConfig) GetTmpDir

func (e *EngineConfig) GetTmpDir() string

GetTmpDir retrieves temporary directory path.

func (*EngineConfig) GetUmask

func (e *EngineConfig) GetUmask() int

GetUmask returns the umask to be used in the container launched process.

func (*EngineConfig) GetUnderlay added in v1.2.0

func (e *EngineConfig) GetUnderlay() bool

GetUnderlay gets the value of whether to use underlay instead of overlay

func (*EngineConfig) GetUnixSocketPair

func (e *EngineConfig) GetUnixSocketPair() [2]int

GetUnixSocketPair returns the unix socketpair previously set in stage one by the engine.

func (*EngineConfig) GetUseBuildConfig added in v1.1.0

func (e *EngineConfig) GetUseBuildConfig() bool

GetUseBuildConfig returns if the build configuration should be used or not.

func (*EngineConfig) GetWorkdir

func (e *EngineConfig) GetWorkdir() string

GetWorkdir retrieves the work directory path.

func (*EngineConfig) GetWritableImage

func (e *EngineConfig) GetWritableImage() bool

GetWritableImage returns if the container image is writable or not.

func (*EngineConfig) GetWritableOverlay added in v1.3.0

func (e *EngineConfig) GetWritableOverlay() bool

GetWritableOverlay gets the value of whether the overlay is writable or not

func (*EngineConfig) GetWritableTmpfs

func (e *EngineConfig) GetWritableTmpfs() bool

GetWritableTmpfs returns if writable tmpfs is set or no.

func (*EngineConfig) GetXdgRuntimeDir added in v1.1.0

func (e *EngineConfig) GetXdgRuntimeDir() string

GetXdgRuntimeDir gets the XDG_RUNTIME_DIR value for rootless operations

func (*EngineConfig) SetAddCaps

func (e *EngineConfig) SetAddCaps(caps string)

SetAddCaps sets bounding/effective/permitted/inheritable/ambient capabilities to add.

func (*EngineConfig) SetAllowSUID

func (e *EngineConfig) SetAllowSUID(allow bool)

SetAllowSUID sets allow-suid flag to allow to run setuid binary inside containee.JSON.

func (*EngineConfig) SetApptainerEnv

func (e *EngineConfig) SetApptainerEnv(senv map[string]string)

SetApptainerEnv sets apptainer environment variables as a key/value string map.

func (*EngineConfig) SetBindPath

func (e *EngineConfig) SetBindPath(bindpath []BindPath)

SetBindPath sets the paths to bind into container.

func (*EngineConfig) SetBootInstance

func (e *EngineConfig) SetBootInstance(boot bool)

SetBootInstance sets boot flag to execute /sbin/init as main instance process.

func (*EngineConfig) SetCgroupsJSON added in v1.1.0

func (e *EngineConfig) SetCgroupsJSON(data string)

SetCgroupsJSON sets cgroups configuration to apply.

func (*EngineConfig) SetCommand

func (e *EngineConfig) SetCommand(command string)

SetCommand sets action command to execute.

func (*EngineConfig) SetConfigDir added in v1.2.3

func (e *EngineConfig) SetConfigDir(name string)

SetConfigDir sets a config directory path.

func (*EngineConfig) SetConfigurationFile

func (e *EngineConfig) SetConfigurationFile(filename string)

SetConfigurationFile sets the apptainer configuration file to use instead of the default one.

func (*EngineConfig) SetContain

func (e *EngineConfig) SetContain(contain bool)

SetContain sets contain flag.

func (*EngineConfig) SetCustomHome

func (e *EngineConfig) SetCustomHome(custom bool)

SetCustomHome sets if home path is a custom path or not.

func (*EngineConfig) SetCwd

func (e *EngineConfig) SetCwd(path string)

SetCwd sets current working directory.

func (*EngineConfig) SetDMTCPConfig added in v1.0.0

func (e *EngineConfig) SetDMTCPConfig(config DMTCPConfig)

SetDMTCPConfig sets the dmtcp configuration for the engine to used for the container process.

func (*EngineConfig) SetDNS

func (e *EngineConfig) SetDNS(dns string)

SetDNS sets a commas separated list of DNS servers to add in resolv.conf.

func (*EngineConfig) SetDbusSessionBusAddress added in v1.1.0

func (e *EngineConfig) SetDbusSessionBusAddress(address string)

SetDbusSessionBusAddress sets a DBUS_SESSION_BUS_ADDRESS value for rootless operations

func (*EngineConfig) SetDeleteTempDir

func (e *EngineConfig) SetDeleteTempDir(dir string)

SetDeleteTempDir sets dir as the path of the temporary directory containing the root filesystem, which must be deleted after use.

func (*EngineConfig) SetDropCaps

func (e *EngineConfig) SetDropCaps(caps string)

SetDropCaps sets bounding/effective/permitted/inheritable/ambient capabilities to drop.

func (*EngineConfig) SetEncryptionKey

func (e *EngineConfig) SetEncryptionKey(key []byte)

SetEncryptionKey sets the key for the image's system partition.

func (*EngineConfig) SetFakeroot

func (e *EngineConfig) SetFakeroot(fakeroot bool)

SetFakeroot sets fakeroot flag.

func (*EngineConfig) SetFakerootPath added in v1.1.0

func (e *EngineConfig) SetFakerootPath(fakerootPath string)

SetFakerootPath sets the fakeroot path

func (*EngineConfig) SetFilesPath

func (e *EngineConfig) SetFilesPath(files []string)

SetFilesPath sets files to bind in container (eg: --nv).

func (*EngineConfig) SetFuseMount

func (e *EngineConfig) SetFuseMount(mount []string) error

SetFuseMount takes a list of fuse mount options and sets fuse mount configuration accordingly.

func (*EngineConfig) SetHomeDest

func (e *EngineConfig) SetHomeDest(dest string)

SetHomeDest sets the container home directory path.

func (*EngineConfig) SetHomeSource

func (e *EngineConfig) SetHomeSource(source string)

SetHomeSource sets the source home directory path.

func (*EngineConfig) SetHostname

func (e *EngineConfig) SetHostname(hostname string)

SetHostname sets hostname to use in containee.JSON.

func (*EngineConfig) SetImage

func (e *EngineConfig) SetImage(name string)

SetImage sets the container image path to be used by EngineConfig.JSON.

func (*EngineConfig) SetImageArg

func (e *EngineConfig) SetImageArg(name string)

SetImageArg sets the container image argument to be used by EngineConfig.JSON.

func (*EngineConfig) SetImageList

func (e *EngineConfig) SetImageList(list []image.Image)

SetImageList sets image list containing opened images.

func (*EngineConfig) SetInstance

func (e *EngineConfig) SetInstance(instance bool)

SetInstance sets if container run as instance or not.

func (*EngineConfig) SetInstanceJoin

func (e *EngineConfig) SetInstanceJoin(join bool)

SetInstanceJoin sets if process joins an instance or not.

func (*EngineConfig) SetKeepPrivs

func (e *EngineConfig) SetKeepPrivs(keep bool)

SetKeepPrivs sets keep-privs flag to allow root to retain all privileges.

func (*EngineConfig) SetLibrariesPath

func (e *EngineConfig) SetLibrariesPath(libraries []string)

SetLibrariesPath sets libraries to bind in container /.singularity.d/libs directory.

func (*EngineConfig) SetNetwork

func (e *EngineConfig) SetNetwork(network string)

SetNetwork sets a list of commas separated networks to configure inside container.

func (*EngineConfig) SetNetworkArgs

func (e *EngineConfig) SetNetworkArgs(args []string)

SetNetworkArgs sets network arguments to pass to CNI plugins.

func (*EngineConfig) SetNoCwd

func (e *EngineConfig) SetNoCwd(val bool)

SetNoCwd set flag to not mount CWD

func (*EngineConfig) SetNoDev

func (e *EngineConfig) SetNoDev(val bool)

SetNoDev set flag to not mount dev directory.

func (*EngineConfig) SetNoDevPts

func (e *EngineConfig) SetNoDevPts(val bool)

SetNoDevPts set flag to not mount dev directory.

func (*EngineConfig) SetNoEval added in v1.1.0

func (e *EngineConfig) SetNoEval(noEval bool)

SetNoEval sets whether to avoid a shell eval on APPTAINERENV_ and in runscripts generated from OCI containers CMD/ENTRYPOINT.

func (*EngineConfig) SetNoHome

func (e *EngineConfig) SetNoHome(val bool)

SetNoHome set flag to not mount user home directory.

func (*EngineConfig) SetNoHostfs

func (e *EngineConfig) SetNoHostfs(val bool)

SetNoHostfs set flag to not mount all host mounts.

func (*EngineConfig) SetNoInit

func (e *EngineConfig) SetNoInit(val bool)

SetNoInit set noinit flag to not start shim init process.

func (*EngineConfig) SetNoPrivs

func (e *EngineConfig) SetNoPrivs(nopriv bool)

SetNoPrivs sets no-privs flag to force root user to lose all privileges.

func (*EngineConfig) SetNoProc

func (e *EngineConfig) SetNoProc(val bool)

SetNoProc set flag to not mount proc directory.

func (*EngineConfig) SetNoSys

func (e *EngineConfig) SetNoSys(val bool)

SetNoSys set flag to not mount sys directory.

func (*EngineConfig) SetNoTmp

func (e *EngineConfig) SetNoTmp(val bool)

SetNoTmp set flag to not mount tmp directories

func (*EngineConfig) SetNvCCLI

func (e *EngineConfig) SetNvCCLI(nvCCLI bool)

SetNvCCLI sets nvcontainer flag to use nvidia-container-cli for CUDA setup

func (*EngineConfig) SetNvCCLIEnv

func (e *EngineConfig) SetNvCCLIEnv(NvCCLIEnv []string)

SetNvCCLIEnv sets env vars holding options for nvidia-container-cli GPU setup

func (*EngineConfig) SetNvLegacy

func (e *EngineConfig) SetNvLegacy(nv bool)

SetNvLegacy sets nvLegacy flag to bind cuda libraries into containee.JSON.

func (*EngineConfig) SetOpenFd

func (e *EngineConfig) SetOpenFd(fds []int)

SetOpenFd sets a list of open file descriptor.

func (*EngineConfig) SetOverlayImage

func (e *EngineConfig) SetOverlayImage(paths []string)

SetOverlayImage sets the overlay image path to be used on top of container image.

func (*EngineConfig) SetRestoreUmask

func (e *EngineConfig) SetRestoreUmask(restoreUmask bool)

SetRestoreUmask returns whether to restore Umask for the container launched process.

func (*EngineConfig) SetRocm

func (e *EngineConfig) SetRocm(rocm bool)

SetRocm sets rocm flag to bind rocm libraries into containee.JSON.

func (*EngineConfig) SetRunscriptTimout added in v1.3.1

func (e *EngineConfig) SetRunscriptTimout(timeout string)

SetRunscriptTimout sets the runscript timeout

func (*EngineConfig) SetScratchDir

func (e *EngineConfig) SetScratchDir(scratchdir []string)

SetScratchDir set a scratch directory path.

func (*EngineConfig) SetSecurity

func (e *EngineConfig) SetSecurity(security []string)

SetSecurity sets security feature arguments.

func (*EngineConfig) SetSessionLayer

func (e *EngineConfig) SetSessionLayer(sessionLayer string)

SetSessionLayer sets the session layer to use to setup the container mount points.

func (*EngineConfig) SetShareNSFd added in v1.3.0

func (e *EngineConfig) SetShareNSFd(fd int)

SetShareNSFd sets the locked fd

func (*EngineConfig) SetShareNSMode added in v1.3.0

func (e *EngineConfig) SetShareNSMode(mode bool)

SetShareNSMode sets whether container should run in shared namespace mode

func (*EngineConfig) SetShell

func (e *EngineConfig) SetShell(shell string)

SetShell sets shell to be used by shell command.

func (*EngineConfig) SetSignalPropagation

func (e *EngineConfig) SetSignalPropagation(propagation bool)

SetSignalPropagation sets if engine must propagate signals from master process -> container process when PID namespace is disabled or from master process -> appinit process -> container process when PID namespace is enabled.

func (*EngineConfig) SetSkipBinds added in v1.1.0

func (e *EngineConfig) SetSkipBinds(val []string)

SetSkipBinds sets bind paths to skip

func (*EngineConfig) SetTargetGID

func (e *EngineConfig) SetTargetGID(gid []int)

SetTargetGID sets target GIDs to execute container process as group IDs.

func (*EngineConfig) SetTargetUID

func (e *EngineConfig) SetTargetUID(uid int)

SetTargetUID sets target UID to execute the container process as user ID.

func (*EngineConfig) SetTmpDir

func (e *EngineConfig) SetTmpDir(name string)

SetTmpDir sets temporary directory path.

func (*EngineConfig) SetUmask

func (e *EngineConfig) SetUmask(umask int)

SetUmask sets the umask to be used in the container launched process.

func (*EngineConfig) SetUnderlay added in v1.2.0

func (e *EngineConfig) SetUnderlay(underlay bool)

SetUnderlay sets whether to use underlay instead of overlay

func (*EngineConfig) SetUnixSocketPair

func (e *EngineConfig) SetUnixSocketPair(fds [2]int)

SetUnixSocketPair sets a unix socketpair used to pass file descriptors between RPC and master process, actually used to pass /dev/fuse file descriptors.

func (*EngineConfig) SetUseBuildConfig added in v1.1.0

func (e *EngineConfig) SetUseBuildConfig(useBuildConfig bool)

SetUseBuildConfig defines whether to use the build configuration or not.

func (*EngineConfig) SetWorkdir

func (e *EngineConfig) SetWorkdir(name string)

SetWorkdir sets a work directory path.

func (*EngineConfig) SetWritableImage

func (e *EngineConfig) SetWritableImage(writable bool)

SetWritableImage defines the container image as writable or not.

func (*EngineConfig) SetWritableOverlay added in v1.3.0

func (e *EngineConfig) SetWritableOverlay(writableOverlay bool)

SetWritableOverlay sets whether the overlay is writable or not

func (*EngineConfig) SetWritableTmpfs

func (e *EngineConfig) SetWritableTmpfs(writable bool)

SetWritableTmpfs sets writable tmpfs flag.

func (*EngineConfig) SetXdgRuntimeDir added in v1.1.0

func (e *EngineConfig) SetXdgRuntimeDir(path string)

SetXdgRuntimeDir sets a XDG_RUNTIME_DIR value for rootless operations

type FuseMount

type FuseMount struct {
	Program       []string  `json:"program,omitempty"`       // the FUSE driver program and all required arguments
	MountPoint    string    `json:"mountPoint,omitempty"`    // the mount point for the FUSE filesystem
	Fd            int       `json:"fd,omitempty"`            // /dev/fuse file descriptor
	FromContainer bool      `json:"fromContainer,omitempty"` // is FUSE driver program is run from container or from host
	Daemon        bool      `json:"daemon,omitempty"`        // is FUSE driver program is run in daemon/background mode
	Cmd           *exec.Cmd `json:"-"`                       // holds the process exec command when FUSE driver run in foreground mode
}

FuseMount stores the FUSE-related information required or provided by plugins implementing options to add FUSE filesystems in the container.

type JSONConfig

type JSONConfig struct {
	ScratchDir            []string          `json:"scratchdir,omitempty"`
	OverlayImage          []string          `json:"overlayImage,omitempty"`
	NetworkArgs           []string          `json:"networkArgs,omitempty"`
	Security              []string          `json:"security,omitempty"`
	FilesPath             []string          `json:"filesPath,omitempty"`
	LibrariesPath         []string          `json:"librariesPath,omitempty"`
	FuseMount             []FuseMount       `json:"fuseMount,omitempty"`
	ImageList             []image.Image     `json:"imageList,omitempty"`
	BindPath              []BindPath        `json:"bindpath,omitempty"`
	ApptainerEnv          map[string]string `json:"apptainerEnv,omitempty"`
	UnixSocketPair        [2]int            `json:"unixSocketPair,omitempty"`
	OpenFd                []int             `json:"openFd,omitempty"`
	TargetGID             []int             `json:"targetGID,omitempty"`
	Image                 string            `json:"image"`
	ImageArg              string            `json:"imageArg"`
	Workdir               string            `json:"workdir,omitempty"`
	ConfigDir             string            `json:"configdir,omitempty"`
	CgroupsJSON           string            `json:"cgroupsJSON,omitempty"`
	HomeSource            string            `json:"homedir,omitempty"`
	HomeDest              string            `json:"homeDest,omitempty"`
	Command               string            `json:"command,omitempty"`
	Shell                 string            `json:"shell,omitempty"`
	FakerootPath          string            `json:"fakerootPath,omitempty"`
	TmpDir                string            `json:"tmpdir,omitempty"`
	AddCaps               string            `json:"addCaps,omitempty"`
	DropCaps              string            `json:"dropCaps,omitempty"`
	Hostname              string            `json:"hostname,omitempty"`
	Network               string            `json:"network,omitempty"`
	DNS                   string            `json:"dns,omitempty"`
	Cwd                   string            `json:"cwd,omitempty"`
	SessionLayer          string            `json:"sessionLayer,omitempty"`
	ConfigurationFile     string            `json:"configurationFile,omitempty"`
	UseBuildConfig        bool              `json:"useBuildConfig,omitempty"`
	EncryptionKey         []byte            `json:"encryptionKey,omitempty"`
	TargetUID             int               `json:"targetUID,omitempty"`
	WritableImage         bool              `json:"writableImage,omitempty"`
	WritableTmpfs         bool              `json:"writableTmpfs,omitempty"`
	Contain               bool              `json:"container,omitempty"`
	NvLegacy              bool              `json:"nvLegacy,omitempty"`
	NvCCLI                bool              `json:"nvCCLI,omitempty"`
	NvCCLIEnv             []string          `json:"NvCCLIEnv,omitempty"`
	Rocm                  bool              `json:"rocm,omitempty"`
	CustomHome            bool              `json:"customHome,omitempty"`
	Instance              bool              `json:"instance,omitempty"`
	InstanceJoin          bool              `json:"instanceJoin,omitempty"`
	BootInstance          bool              `json:"bootInstance,omitempty"`
	RunPrivileged         bool              `json:"runPrivileged,omitempty"`
	AllowSUID             bool              `json:"allowSUID,omitempty"`
	KeepPrivs             bool              `json:"keepPrivs,omitempty"`
	NoPrivs               bool              `json:"noPrivs,omitempty"`
	NoProc                bool              `json:"noProc,omitempty"`
	NoSys                 bool              `json:"noSys,omitempty"`
	NoDev                 bool              `json:"noDev,omitempty"`
	NoDevPts              bool              `json:"noDevPts,omitempty"`
	NoHome                bool              `json:"noHome,omitempty"`
	NoTmp                 bool              `json:"noTmp,omitempty"`
	NoHostfs              bool              `json:"noHostfs,omitempty"`
	NoCwd                 bool              `json:"noCwd,omitempty"`
	SkipBinds             []string          `json:"skipBinds,omitempty"`
	NoInit                bool              `json:"noInit,omitempty"`
	Fakeroot              bool              `json:"fakeroot,omitempty"`
	SignalPropagation     bool              `json:"signalPropagation,omitempty"`
	RestoreUmask          bool              `json:"restoreUmask,omitempty"`
	DeleteTempDir         string            `json:"deleteTempDir,omitempty"`
	Umask                 int               `json:"umask,omitempty"`
	DMTCPConfig           DMTCPConfig       `json:"dmtcpConfig,omitempty"`
	XdgRuntimeDir         string            `json:"xdgRuntimeDir,omitempty"`
	DbusSessionBusAddress string            `json:"dbusSessionBusAddress,omitempty"`
	NoEval                bool              `json:"noEval,omitempty"`
	Underlay              bool              `json:"underlay,omitempty"`
	UserInfo              UserInfo          `json:"userInfo,omitempty"`
	WritableOverlay       bool              `json:"writableOverlay,omitempty"`
	ShareNSMode           bool              `json:"sharensMode,omitempty"`
	ShareNSFd             int               `json:"sharensFd,omitempty"`
	RunscriptTimeout      string            `json:"runscriptTimeout,omitempty"`
}

JSONConfig stores engine specific configuration that is allowed to be set by the user.

type UserInfo added in v1.2.0

type UserInfo struct {
	Username string         `json:"username,omitempty"`
	Home     string         `json:"home,omitempty"`
	UID      int            `json:"uid,omitempty"`
	GID      int            `json:"gid,omitempty"`
	Groups   map[int]string `json:"groups,omitempty"`
	Gecos    string         `json:"gecos,omitempty"`
	Shell    string         `json:"shell,omitempty"`
}

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL