configs
packageThis package is not in the latest version of its module.
Details
Validgo.mod file
The Go module system was introduced in Go 1.11 and is the official dependency management solution for Go.
Redistributable license
Redistributable licenses place minimal restrictions on how software can be used, modified, and redistributed.
Tagged version
Modules with tagged versions give importers more predictable builds.
Stable version
When a project reaches major version v1 it is considered stable.
- Learn more about best practices
Repository
Links
Documentation¶
Index¶
- Constants
- Variables
- func IsNamespaceSupported(ns NamespaceType) bool
- func KnownHookNames() []string
- func NsName(ns NamespaceType) string
- func ToSchedAttr(scheduler *Scheduler) (*unix.SchedAttr, error)
- type Action
- type Arg
- type BlockIODevice
- type CPUAffinity
- type Capabilities
- type Cgroup
- type Command
- type CommandHook
- type Config
- type FreezerState
- type FuncHook
- type Hook
- type HookList
- type HookName
- type Hooks
- type HugepageLimit
- type IDMap
- type IOPriority
- type IfPrioMap
- type IntelRdt
- type LinuxPersonality
- type LinuxRdma
- type Mount
- type MountIDMapping
- type Namespace
- type NamespaceType
- type Namespaces
- type Network
- type Operator
- type Resources
- type Rlimit
- type Route
- type Scheduler
- type Seccomp
- type Syscall
- type ThrottleDevice
- type WeightDevice
Constants¶
const (PerLinux = 0x0000PerLinux32 = 0x0008)
Please checkhttps://man7.org/linux/man-pages/man2/personality.2.html for const details.https://raw.githubusercontent.com/torvalds/linux/master/include/uapi/linux/personality.h
const (// EXT_COPYUP is a directive to copy up the contents of a directory when// a tmpfs is mounted over it.EXT_COPYUP = 1 <<iota//nolint:golint,revive // ignore "don't use ALL_CAPS" warning)
Variables¶
var (NewWeightDevice =cgroups.NewWeightDeviceNewThrottleDevice =cgroups.NewThrottleDevice)
Functions¶
funcIsNamespaceSupported¶added inv0.0.9
func IsNamespaceSupported(nsNamespaceType)bool
IsNamespaceSupported returns whether a namespace is available ornot
funcKnownHookNames¶added inv1.1.0
func KnownHookNames() []string
KnownHookNames returns the known hook names.Used by `runc features`.
funcNsName¶added inv1.0.0
func NsName(nsNamespaceType)string
NsName converts the namespace type to its filename
Types¶
typeArg¶
type Arg struct {Indexuint `json:"index"`Valueuint64 `json:"value"`ValueTwouint64 `json:"value_two"`OpOperator `json:"op"`}
Arg is a rule to match a specific syscall argument in Seccomp
typeBlockIODevice¶added inv1.2.0
type BlockIODevice =cgroups.BlockIODevice
typeCPUAffinity¶added inv1.3.0
funcConvertCPUAffinity¶added inv1.3.0
func ConvertCPUAffinity(sa *specs.CPUAffinity) (*CPUAffinity,error)
ConvertCPUAffinity convertsspecs.CPUAffinity toCPUAffinity.
typeCapabilities¶added inv1.0.0
type Capabilities struct {// Bounding is the set of capabilities checked by the kernel.Bounding []string// Effective is the set of capabilities checked by the kernel.Effective []string// Inheritable is the capabilities preserved across execve.Inheritable []string// Permitted is the limiting superset for effective capabilities.Permitted []string// Ambient is the ambient set of capabilities that are kept.Ambient []string}
typeCommand¶
typeCommandHook¶added inv0.0.4
type CommandHook struct {*Command}
funcNewCommandHook¶added inv0.0.4
func NewCommandHook(cmd *Command)CommandHook
NewCommandHook will execute the provided command when the hook is run.
typeConfig¶
type Config struct {// NoPivotRoot will use MS_MOVE and a chroot to jail the process into the container's rootfs// This is a common option when the container is running in ramdiskNoPivotRootbool `json:"no_pivot_root"`// ParentDeathSignal specifies the signal that is sent to the container's process in the case// that the parent process dies.ParentDeathSignalint `json:"parent_death_signal"`// Path to a directory containing the container's root filesystem.Rootfsstring `json:"rootfs"`// Umask is the umask to use inside of the container.Umask *uint32 `json:"umask"`// Readonlyfs will remount the container's rootfs as readonly where only externally mounted// bind mounts are writtable.Readonlyfsbool `json:"readonlyfs"`// Specifies the mount propagation flags to be applied to /.RootPropagationint `json:"rootPropagation"`// Mounts specify additional source and destination paths that will be mounted inside the container's// rootfs and mount namespace if specifiedMounts []*Mount `json:"mounts"`// The device nodes that should be automatically created within the container upon container start. Note, make sure that the node is marked as allowed in the cgroup as well!Devices []*devices.Device `json:"devices"`MountLabelstring `json:"mount_label"`// Hostname optionally sets the container's hostname if providedHostnamestring `json:"hostname"`// Domainname optionally sets the container's domainname if providedDomainnamestring `json:"domainname"`// Namespaces specifies the container's namespaces that it should setup when cloning the init process// If a namespace is not provided that namespace is shared from the container's parent processNamespacesNamespaces `json:"namespaces"`// Capabilities specify the capabilities to keep when executing the process inside the container// All capabilities not specified will be dropped from the processes capability maskCapabilities *Capabilities `json:"capabilities"`// Networks specifies the container's network setup to be createdNetworks []*Network `json:"networks"`// Routes can be specified to create entries in the route table as the container is startedRoutes []*Route `json:"routes"`// Cgroups specifies specific cgroup settings for the various subsystems that the container is// placed into to limit the resources the container has availableCgroups *Cgroup `json:"cgroups"`// AppArmorProfile specifies the profile to apply to the process running in the container and is// change at the time the process is execedAppArmorProfilestring `json:"apparmor_profile,omitempty"`// ProcessLabel specifies the label to apply to the process running in the container. It is// commonly used by selinuxProcessLabelstring `json:"process_label,omitempty"`// Rlimits specifies the resource limits, such as max open files, to set in the container// If Rlimits are not set, the container will inherit rlimits from the parent processRlimits []Rlimit `json:"rlimits,omitempty"`// OomScoreAdj specifies the adjustment to be made by the kernel when calculating oom scores// for a process. Valid values are between the range [-1000, '1000'], where processes with// higher scores are preferred for being killed. If it is unset then we don't touch the current// value.// More information about kernel oom score calculation here:https://lwn.net/Articles/317814/OomScoreAdj *int `json:"oom_score_adj,omitempty"`// UIDMappings is an array of User ID mappings for User NamespacesUIDMappings []IDMap `json:"uid_mappings"`// GIDMappings is an array of Group ID mappings for User NamespacesGIDMappings []IDMap `json:"gid_mappings"`// MaskPaths specifies paths within the container's rootfs to mask over with a bind// mount pointing to /dev/null as to prevent reads of the file.MaskPaths []string `json:"mask_paths"`// ReadonlyPaths specifies paths within the container's rootfs to remount as read-only// so that these files prevent any writes.ReadonlyPaths []string `json:"readonly_paths"`// Sysctl is a map of properties and their values. It is the equivalent of using// sysctl -w my.property.name value in Linux.Sysctl map[string]string `json:"sysctl"`// Seccomp allows actions to be taken whenever a syscall is made within the container.// A number of rules are given, each having an action to be taken if a syscall matches it.// A default action to be taken if no rules match is also given.Seccomp *Seccomp `json:"seccomp"`// NoNewPrivileges controls whether processes in the container can gain additional privileges.NoNewPrivilegesbool `json:"no_new_privileges,omitempty"`// Hooks are a collection of actions to perform at various container lifecycle events.// CommandHooks are serialized to JSON, but other hooks are not.HooksHooks// Version is the version of opencontainer specification that is supported.Versionstring `json:"version"`// Labels are user defined metadata that is stored in the config and populated on the stateLabels []string `json:"labels"`// NoNewKeyring will not allocated a new session keyring for the container. It will use the// callers keyring in this case.NoNewKeyringbool `json:"no_new_keyring"`// IntelRdt specifies settings for Intel RDT group that the container is placed into// to limit the resources (e.g., L3 cache, memory bandwidth) the container has availableIntelRdt *IntelRdt `json:"intel_rdt,omitempty"`// RootlessEUID is set when the runc was launched with non-zero EUID.// Note that RootlessEUID is set to false when launched with EUID=0 in userns.// When RootlessEUID is set, runc creates a new userns for the container.// (config.json needs to contain userns settings)RootlessEUIDbool `json:"rootless_euid,omitempty"`// RootlessCgroups is set when unlikely to have the full access to cgroups.// When RootlessCgroups is set, cgroups errors are ignored.RootlessCgroupsbool `json:"rootless_cgroups,omitempty"`// TimeOffsets specifies the offset for supporting time namespaces.TimeOffsets map[string]specs.LinuxTimeOffset `json:"time_offsets,omitempty"`// Scheduler represents the scheduling attributes for a process.Scheduler *Scheduler `json:"scheduler,omitempty"`// Personality contains configuration for the Linux personality syscall.Personality *LinuxPersonality `json:"personality,omitempty"`// IOPriority is the container's I/O priority.IOPriority *IOPriority `json:"io_priority,omitempty"`// ExecCPUAffinity is CPU affinity for a non-init process to be run in the container.ExecCPUAffinity *CPUAffinity `json:"exec_cpu_affinity,omitempty"`}
Config defines configuration options for executing a process inside a contained environment.
func (*Config)HasHook¶added inv1.3.0
HasHook checks if config has any hooks with any given names configured.
func (Config)HostGID¶
HostGID gets the translated gid for the process on host which could bedifferent when user namespaces are enabled.
func (Config)HostRootGID¶added inv1.0.0
HostRootGID gets the root gid for the process on host which could be non-zerowhen user namespaces are enabled.
func (Config)HostRootUID¶added inv1.0.0
HostRootUID gets the root uid for the process on host which could be non-zerowhen user namespaces are enabled.
typeFreezerState¶
type FreezerState =cgroups.FreezerState
typeFuncHook¶added inv0.0.4
type FuncHook struct {// contains filtered or unexported fields}
funcNewFunctionHook¶added inv0.0.4
NewFunctionHook will call the provided function when the hook is run.
typeHook¶added inv0.0.4
type Hook interface {// Run executes the hook with the provided state.Run(*specs.State)error}
typeHookList¶added inv1.0.0
type HookList []Hook
func (HookList)SetDefaultEnv¶added inv1.3.0
SetDefaultEnv sets the environment for those CommandHook entriesthat do not have one set.
typeHookName¶added inv1.0.0
type HookNamestring
const (// Prestart commands are executed after the container namespaces are created,// but before the user supplied command is executed from init.// Note: This hook is now deprecated// Prestart commands are called in the Runtime namespace.PrestartHookName = "prestart"// CreateRuntime commands MUST be called as part of the create operation after// the runtime environment has been created but before the pivot_root has been executed.// CreateRuntime is called immediately after the deprecated Prestart hook.// CreateRuntime commands are called in the Runtime Namespace.CreateRuntimeHookName = "createRuntime"// CreateContainer commands MUST be called as part of the create operation after// the runtime environment has been created but before the pivot_root has been executed.// CreateContainer commands are called in the Container namespace.CreateContainerHookName = "createContainer"// StartContainer commands MUST be called as part of the start operation and before// the container process is started.// StartContainer commands are called in the Container namespace.StartContainerHookName = "startContainer"// Poststart commands are executed after the container init process starts.// Poststart commands are called in the Runtime Namespace.PoststartHookName = "poststart"// Poststop commands are executed after the container init process exits.// Poststop commands are called in the Runtime Namespace.PoststopHookName = "poststop")
typeHooks¶added inv0.0.4
func (*Hooks)MarshalJSON¶added inv0.0.9
func (*Hooks)UnmarshalJSON¶added inv0.0.9
typeHugepageLimit¶
type HugepageLimit =cgroups.HugepageLimit
typeIDMap¶
type IDMap struct {ContainerIDint64 `json:"container_id"`HostIDint64 `json:"host_id"`Sizeint64 `json:"size"`}
IDMap represents UID/GID Mappings for User Namespaces.
typeIOPriority¶added inv1.2.0
type IOPriority = specs.LinuxIOPriority
typeIntelRdt¶added inv1.0.0
type IntelRdt struct {// The identity for RDT Class of ServiceClosIDstring `json:"closID,omitempty"`// The schema for L3 cache id and capacity bitmask (CBM)// Format: "L3:<cache_id0>=<cbm0>;<cache_id1>=<cbm1>;..."L3CacheSchemastring `json:"l3_cache_schema,omitempty"`// The schema of memory bandwidth per L3 cache id// Format: "MB:<cache_id0>=bandwidth0;<cache_id1>=bandwidth1;..."// The unit of memory bandwidth is specified in "percentages" by// default, and in "MBps" if MBA Software Controller is enabled.MemBwSchemastring `json:"memBwSchema,omitempty"`}
typeLinuxPersonality¶added inv1.2.0
type LinuxPersonality struct {// Domain for the personality// can only contain values "LINUX" and "LINUX32"Domainint `json:"domain"`}
typeMount¶
type Mount struct {// Source path for the mount.Sourcestring `json:"source"`// Destination path for the mount inside the container.Destinationstring `json:"destination"`// Device the mount is for.Devicestring `json:"device"`// Mount flags.Flagsint `json:"flags"`// Mount flags that were explicitly cleared in the configuration (meaning// the user explicitly requested that these flags *not* be set).ClearedFlagsint `json:"cleared_flags"`// Propagation FlagsPropagationFlags []int `json:"propagation_flags"`// Mount data applied to the mount.Datastring `json:"data"`// Relabel source if set, "z" indicates shared, "Z" indicates unshared.Relabelstring `json:"relabel"`// RecAttr represents mount properties to be applied recursively (AT_RECURSIVE), see mount_setattr(2).RecAttr *unix.MountAttr `json:"rec_attr"`// Extensions are additional flags that are specific to runc.Extensionsint `json:"extensions"`// Mapping is the MOUNT_ATTR_IDMAP configuration for the mount. If non-nil,// the mount is configured to use MOUNT_ATTR_IDMAP-style id mappings.IDMapping *MountIDMapping `json:"id_mapping,omitempty"`}
func (*Mount)IsIDMapped¶added inv1.2.0
typeMountIDMapping¶added inv1.2.0
type MountIDMapping struct {// Recursive indicates if the mapping needs to be recursive.Recursivebool `json:"recursive"`// UserNSPath is a path to a user namespace that indicates the necessary// id-mappings for MOUNT_ATTR_IDMAP. If set to non-"", UIDMappings and// GIDMappings must be set to nil.UserNSPathstring `json:"userns_path,omitempty"`// UIDMappings is the uid mapping set for this mount, to be used with// MOUNT_ATTR_IDMAP.UIDMappings []IDMap `json:"uid_mappings,omitempty"`// GIDMappings is the gid mapping set for this mount, to be used with// MOUNT_ATTR_IDMAP.GIDMappings []IDMap `json:"gid_mappings,omitempty"`}
typeNamespace¶
type Namespace struct {TypeNamespaceType `json:"type"`Pathstring `json:"path"`}
Namespace defines configuration for each namespace. It specifies analternate path that is able to be joined via setns.
typeNamespaceType¶
type NamespaceTypestring
const (NEWNETNamespaceType = "NEWNET"NEWPIDNamespaceType = "NEWPID"NEWNSNamespaceType = "NEWNS"NEWUTSNamespaceType = "NEWUTS"NEWIPCNamespaceType = "NEWIPC"NEWUSERNamespaceType = "NEWUSER"NEWCGROUPNamespaceType = "NEWCGROUP"NEWTIMENamespaceType = "NEWTIME")
funcNamespaceTypes¶
func NamespaceTypes() []NamespaceType
typeNamespaces¶
type Namespaces []Namespace
func (*Namespaces)Add¶
func (n *Namespaces) Add(tNamespaceType, pathstring)
func (*Namespaces)CloneFlags¶
func (n *Namespaces) CloneFlags()uintptr
CloneFlags parses the container's Namespaces options to set the correctflags on clone, unshare. This function returns flags only for new namespaces.
func (*Namespaces)Contains¶
func (n *Namespaces) Contains(tNamespaceType)bool
func (Namespaces)IsPrivate¶added inv1.2.0
func (nNamespaces) IsPrivate(tNamespaceType)bool
IsPrivate tells whether the namespace of type t is configured as private(i.e. it exists and is not shared).
func (*Namespaces)PathOf¶added inv0.0.9
func (n *Namespaces) PathOf(tNamespaceType)string
func (*Namespaces)Remove¶
func (n *Namespaces) Remove(tNamespaceType)bool
typeNetwork¶
type Network struct {// Type sets the networks type, commonly veth and loopbackTypestring `json:"type"`// Name of the network interfaceNamestring `json:"name"`// The bridge to use.Bridgestring `json:"bridge"`// MacAddress contains the MAC address to set on the network interfaceMacAddressstring `json:"mac_address"`// Address contains the IPv4 and mask to set on the network interfaceAddressstring `json:"address"`// Gateway sets the gateway address that is used as the default for the interfaceGatewaystring `json:"gateway"`// IPv6Address contains the IPv6 and mask to set on the network interfaceIPv6Addressstring `json:"ipv6_address"`// IPv6Gateway sets the ipv6 gateway address that is used as the default for the interfaceIPv6Gatewaystring `json:"ipv6_gateway"`// Mtu sets the mtu value for the interface and will be mirrored on both the host and// container's interfaces if a pair is created, specifically in the case of type veth// Note: This does not apply to loopback interfaces.Mtuint `json:"mtu"`// TxQueueLen sets the tx_queuelen value for the interface and will be mirrored on both the host and// container's interfaces if a pair is created, specifically in the case of type veth// Note: This does not apply to loopback interfaces.TxQueueLenint `json:"txqueuelen"`// HostInterfaceName is a unique name of a veth pair that resides on in the host interface of the// container.HostInterfaceNamestring `json:"host_interface_name"`// HairpinMode specifies if hairpin NAT should be enabled on the virtual interface// bridge port in the case of type veth// Note: This is unsupported on some systems.// Note: This does not apply to loopback interfaces.HairpinModebool `json:"hairpin_mode"`}
Network defines configuration for a container's networking stack
The network configuration can be omitted from a container causing thecontainer to be setup with the host's networking stack
typeOperator¶
type Operatorint
Operator is a comparison operator to be used when matching syscall arguments in Seccomp
typeRoute¶
type Route struct {// Destination specifies the destination IP address and mask in the CIDR form.Destinationstring `json:"destination"`// Source specifies the source IP address and mask in the CIDR form.Sourcestring `json:"source"`// Gateway specifies the gateway IP address.Gatewaystring `json:"gateway"`// InterfaceName specifies the device to set this route up for, for example eth0.InterfaceNamestring `json:"interface_name"`}
Route defines a routing table entry.
Routes can be specified to create entries in the routing table as the containeris started.
All of destination, source, and gateway should be either IPv4 or IPv6.One of the three options must be present, and omitted entries will use theirIP family default for the route table. For IPv4 for example, setting thegateway to 1.2.3.4 and the interface to eth0 will set up a standarddestination of 0.0.0.0(or *) when viewed in the route table.
typeScheduler¶added inv1.2.0
type Scheduler = specs.Scheduler
Scheduler is based on the Linux sched_setattr(2) syscall.
typeSeccomp¶
type Seccomp struct {DefaultActionAction `json:"default_action"`Architectures []string `json:"architectures"`Flags []specs.LinuxSeccompFlag `json:"flags"`Syscalls []*Syscall `json:"syscalls"`DefaultErrnoRet *uint `json:"default_errno_ret"`ListenerPathstring `json:"listener_path,omitempty"`ListenerMetadatastring `json:"listener_metadata,omitempty"`}
Seccomp represents syscall restrictionsBy default, only the native architecture of the kernel is allowed to be usedfor syscalls. Additional architectures can be added by specifying them inArchitectures.
typeSyscall¶
type Syscall struct {Namestring `json:"name"`ActionAction `json:"action"`ErrnoRet *uint `json:"errnoRet"`Args []*Arg `json:"args"`}
Syscall is a rule to match a syscall in Seccomp
typeThrottleDevice¶added inv0.0.5
type ThrottleDevice =cgroups.ThrottleDevice
typeWeightDevice¶added inv0.0.5
type WeightDevice =cgroups.WeightDevice