lxc-0.3.1.1: High level Haskell bindings to LXC (Linux containers).

Copyright(c) Nickolay Kudasov 2014
LicenseBSD-style (see the file LICENSE)
Maintainernickolay.kudasov@gmail.com
Safe HaskellNone
LanguageHaskell2010

System.LXC.AttachOptions

Contents

Description

Options and structures to run commands inside LXC containers. You can get more info about LXC at https://help.ubuntu.com/lts/serverguide/lxc.html and https://linuxcontainers.org.

Normally you should import System.LXC module only.

Synopsis

Attach options

data AttachOptions

LXC attach options for attach.

  • NOTE: for stdin, stdout and stderr descriptors dup2() will be used before calling exec_function, (assuming not 0, 1 and 2 are specified) and the original fds are closed before passing control over. Any O_CLOEXEC flag will be removed after that.

Constructors

AttachOptions 

Fields

attachFlags :: [AttachFlag]

Any combination of AttachFlag flags.

attachNamespaces :: Int

The namespaces to attach to (CLONE_NEW... flags). | Initial personality (Nothing to autodetect).

  • This may be ignored if lxc is compiled without personality support
attachPersonality :: Maybe Int64
 
attachInitialCWD :: Maybe FilePath

Inital current directory, Nothing to use cwd.

If the current directory does not exist in the container, the root directory will be used instead because of kernel defaults.

attachUID :: UserID

The user-id to run as.

  • NOTE: Set to -1 for default behaviour (init uid for userns containers or 0 (super-user) if detection fails).
attachGID :: GroupID

The group-id to run as.

  • NOTE: Set to -1 for default behaviour (init gid for userns containers or 0 (super-user) if detection fails).
attachEnvPolicy :: AttachEnvPolicy

Environment policy.

attachExtraEnvVars :: [String]

Extra environment variables to set in the container environment.

attachExtraKeepEnv :: [String]

Names of environment variables in existing environment to retain in container environment.

attachStdinFD :: Fd

stdin file descriptor.

attachStdoutFD :: Fd

stdout file descriptor.

attachStderrFD :: Fd

stderr file descriptor.

Instances

defaultAttachOptions :: AttachOptions

Default attach options to use.

Attach command

data AttachCommand

Representation of a command to run in a container.

Constructors

AttachCommand 

Fields

attachProgram :: FilePath

The program to run (passed to execvp).

attachArgv :: [String]

The argv of that program, including the program itself as the first element.

Attach exec functions

newtype AttachExecFn

exec function to use for attach.

See attachRunCommand and attachRunShell.

Constructors

AttachExecFn 

Fields

getAttachExecFn :: C_lxc_attach_exec_t
 

attachRunCommand :: AttachExecFn

Run a command in the container.

attachRunShell :: AttachExecFn

Run a shell command in the container.

Flags and environment policies

data AttachEnvPolicy

LXC environment policy.

Constructors

AttachKeepEnv

Retain the environment.

AttachClearEnv

Clear the environment.

data AttachFlag

Flags for attach.

Constructors

AttachMoveToCGroup

Move to cgroup. On by default.

AttachDropCapabilities

Drop capabilities. On by default.

AttachSetPersonality

Set personality. On by default

AttachLSMExec

Execute under a Linux Security Module. On by default.

AttachRemountProcSys

Remount /proc filesystem. Off by default.

AttachLSMNow

FIXME: unknown. Off by default.

AttachDefault

Mask of flags to apply by default.

AttachLSM

All Linux Security Module flags.

fromAttachEnvPolicy :: Num a => AttachEnvPolicy -> a

Convert AttachEnvPolicy to internal representation.

fromAttachFlag :: Num a => AttachFlag -> a

Convert AttachFlag to bit flag.