You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: libcontainer/configs/config.go
+3-154Lines changed: 3 additions & 154 deletions
Original file line number
Diff line number
Diff line change
@@ -6,170 +6,19 @@ import (
6
6
"os/exec"
7
7
)
8
8
9
-
typeRlimitstruct {
10
-
Typeint`json:"type"`
11
-
Harduint64`json:"hard"`
12
-
Softuint64`json:"soft"`
13
-
}
14
-
15
-
// IDMap represents UID/GID Mappings for User Namespaces.
16
-
typeIDMapstruct {
17
-
ContainerIDint`json:"container_id"`
18
-
HostIDint`json:"host_id"`
19
-
Sizeint`json:"size"`
20
-
}
21
-
22
-
// Seccomp represents syscall restrictions
23
-
// By default, only the native architecture of the kernel is allowed to be used
24
-
// for syscalls. Additional architectures can be added by specifying them in
25
-
// Architectures.
26
-
typeSeccompstruct {
27
-
DefaultActionAction`json:"default_action"`
28
-
Architectures []string`json:"architectures"`
29
-
Syscalls []*Syscall`json:"syscalls"`
30
-
}
31
-
32
-
// An action to be taken upon rule match in Seccomp
33
-
typeActionint
34
-
35
-
const (
36
-
KillAction=iota-4
37
-
Errno
38
-
Trap
39
-
Allow
40
-
)
41
-
42
-
// A comparison operator to be used when matching syscall arguments in Seccomp
43
-
typeOperatorint
44
-
45
-
const (
46
-
EqualToOperator=iota
47
-
NotEqualTo
48
-
GreaterThan
49
-
GreaterThanOrEqualTo
50
-
LessThan
51
-
LessThanOrEqualTo
52
-
MaskEqualTo
53
-
)
54
-
55
-
// A rule to match a specific syscall argument in Seccomp
56
-
typeArgstruct {
57
-
Indexuint`json:"index"`
58
-
Valueuint64`json:"value"`
59
-
ValueTwouint64`json:"value_two"`
60
-
OpOperator`json:"op"`
61
-
}
62
-
63
-
// An rule to match a syscall in Seccomp
64
-
typeSyscallstruct {
65
-
Namestring`json:"name"`
66
-
ActionAction`json:"action"`
67
-
Args []*Arg`json:"args"`
68
-
}
69
-
70
-
// TODO Windows. Many of these fields should be factored out into those parts
71
-
// which are common across platforms, and those which are platform specific.
72
-
73
-
// Config defines configuration options for executing a process inside a contained environment.
74
-
typeConfigstruct {
75
-
// NoPivotRoot will use MS_MOVE and a chroot to jail the process into the container's rootfs
76
-
// This is a common option when the container is running in ramdisk
77
-
NoPivotRootbool`json:"no_pivot_root"`
78
-
79
-
// ParentDeathSignal specifies the signal that is sent to the container's process in the case
80
-
// that the parent process dies.
81
-
ParentDeathSignalint`json:"parent_death_signal"`
82
-
83
-
// PivotDir allows a custom directory inside the container's root filesystem to be used as pivot, when NoPivotRoot is not set.
84
-
// When a custom PivotDir not set, a temporary dir inside the root filesystem will be used. The pivot dir needs to be writeable.
85
-
// This is required when using read only root filesystems. In these cases, a read/writeable path can be (bind) mounted somewhere inside the root filesystem to act as pivot.
86
-
PivotDirstring`json:"pivot_dir"`
87
-
9
+
// BaseConfig defines the platform agnostic configuration options for executing
10
+
// a process inside a contained environment.
11
+
typeBaseConfigstruct {
88
12
// Path to a directory containing the container's root filesystem.
89
13
Rootfsstring`json:"rootfs"`
90
14
91
-
// Readonlyfs will remount the container's rootfs as readonly where only externally mounted
92
-
// bind mounts are writtable.
93
-
Readonlyfsbool`json:"readonlyfs"`
94
-
95
-
// Specifies the mount propagation flags to be applied to /.
96
-
RootPropagationint`json:"rootPropagation"`
97
-
98
15
// Mounts specify additional source and destination paths that will be mounted inside the container's
99
16
// rootfs and mount namespace if specified
100
17
Mounts []*Mount`json:"mounts"`
101
18
102
-
// 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!
103
-
Devices []*Device`json:"devices"`
104
-
105
-
MountLabelstring`json:"mount_label"`
106
-
107
19
// Hostname optionally sets the container's hostname if provided
108
20
Hostnamestring`json:"hostname"`
109
21
110
-
// Namespaces specifies the container's namespaces that it should setup when cloning the init process
111
-
// If a namespace is not provided that namespace is shared from the container's parent process
112
-
NamespacesNamespaces`json:"namespaces"`
113
-
114
-
// Capabilities specify the capabilities to keep when executing the process inside the container
115
-
// All capbilities not specified will be dropped from the processes capability mask
116
-
Capabilities []string`json:"capabilities"`
117
-
118
-
// Networks specifies the container's network setup to be created
119
-
Networks []*Network`json:"networks"`
120
-
121
-
// Routes can be specified to create entries in the route table as the container is started
122
-
Routes []*Route`json:"routes"`
123
-
124
-
// Cgroups specifies specific cgroup settings for the various subsystems that the container is
125
-
// placed into to limit the resources the container has available
126
-
Cgroups*Cgroup`json:"cgroups"`
127
-
128
-
// AppArmorProfile specifies the profile to apply to the process running in the container and is
129
-
// change at the time the process is execed
130
-
AppArmorProfilestring`json:"apparmor_profile"`
131
-
132
-
// ProcessLabel specifies the label to apply to the process running in the container. It is
133
-
// commonly used by selinux
134
-
ProcessLabelstring`json:"process_label"`
135
-
136
-
// Rlimits specifies the resource limits, such as max open files, to set in the container
137
-
// If Rlimits are not set, the container will inherit rlimits from the parent process
138
-
Rlimits []Rlimit`json:"rlimits"`
139
-
140
-
// OomScoreAdj specifies the adjustment to be made by the kernel when calculating oom scores
141
-
// for a process. Valid values are between the range [-1000, '1000'], where processes with
142
-
// higher scores are preferred for being killed.
143
-
// More information about kernel oom score calculation here: https://lwn.net/Articles/317814/
144
-
OomScoreAdjint`json:"oom_score_adj"`
145
-
146
-
// AdditionalGroups specifies the gids that should be added to supplementary groups
Copy file name to clipboardExpand all lines: libcontainer/configs/config_unix.go
+156Lines changed: 156 additions & 0 deletions
Original file line number
Diff line number
Diff line change
@@ -4,6 +4,162 @@ package configs
4
4
5
5
import"fmt"
6
6
7
+
typeRlimitstruct {
8
+
Typeint`json:"type"`
9
+
Harduint64`json:"hard"`
10
+
Softuint64`json:"soft"`
11
+
}
12
+
13
+
// IDMap represents UID/GID Mappings for User Namespaces.
14
+
typeIDMapstruct {
15
+
ContainerIDint`json:"container_id"`
16
+
HostIDint`json:"host_id"`
17
+
Sizeint`json:"size"`
18
+
}
19
+
20
+
// Seccomp represents syscall restrictions
21
+
// By default, only the native architecture of the kernel is allowed to be used
22
+
// for syscalls. Additional architectures can be added by specifying them in
23
+
// Architectures.
24
+
typeSeccompstruct {
25
+
DefaultActionAction`json:"default_action"`
26
+
Architectures []string`json:"architectures"`
27
+
Syscalls []*Syscall`json:"syscalls"`
28
+
}
29
+
30
+
// An action to be taken upon rule match in Seccomp
31
+
typeActionint
32
+
33
+
const (
34
+
KillAction=iota-4
35
+
Errno
36
+
Trap
37
+
Allow
38
+
)
39
+
40
+
// A comparison operator to be used when matching syscall arguments in Seccomp
41
+
typeOperatorint
42
+
43
+
const (
44
+
EqualToOperator=iota
45
+
NotEqualTo
46
+
GreaterThan
47
+
GreaterThanOrEqualTo
48
+
LessThan
49
+
LessThanOrEqualTo
50
+
MaskEqualTo
51
+
)
52
+
53
+
// A rule to match a specific syscall argument in Seccomp
54
+
typeArgstruct {
55
+
Indexuint`json:"index"`
56
+
Valueuint64`json:"value"`
57
+
ValueTwouint64`json:"value_two"`
58
+
OpOperator`json:"op"`
59
+
}
60
+
61
+
// An rule to match a syscall in Seccomp
62
+
typeSyscallstruct {
63
+
Namestring`json:"name"`
64
+
ActionAction`json:"action"`
65
+
Args []*Arg`json:"args"`
66
+
}
67
+
68
+
// Config defines configuration options for executing a process inside a contained environment.
69
+
typeConfigstruct {
70
+
BaseConfig
71
+
72
+
// Fields below here are platform specific
73
+
74
+
// NoPivotRoot will use MS_MOVE and a chroot to jail the process into the container's rootfs
75
+
// This is a common option when the container is running in ramdisk
76
+
NoPivotRootbool`json:"no_pivot_root"`
77
+
78
+
// ParentDeathSignal specifies the signal that is sent to the container's process in the case
79
+
// that the parent process dies.
80
+
ParentDeathSignalint`json:"parent_death_signal"`
81
+
82
+
// PivotDir allows a custom directory inside the container's root filesystem to be used as pivot, when NoPivotRoot is not set.
83
+
// When a custom PivotDir not set, a temporary dir inside the root filesystem will be used. The pivot dir needs to be writeable.
84
+
// This is required when using read only root filesystems. In these cases, a read/writeable path can be (bind) mounted somewhere inside the root filesystem to act as pivot.
85
+
PivotDirstring`json:"pivot_dir"`
86
+
87
+
// Readonlyfs will remount the container's rootfs as readonly where only externally mounted
88
+
// bind mounts are writtable.
89
+
Readonlyfsbool`json:"readonlyfs"`
90
+
91
+
// Specifies the mount propagation flags to be applied to /.
92
+
RootPropagationint`json:"rootPropagation"`
93
+
94
+
// 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!
95
+
Devices []*Device`json:"devices"`
96
+
97
+
MountLabelstring`json:"mount_label"`
98
+
99
+
// Namespaces specifies the container's namespaces that it should setup when cloning the init process
100
+
// If a namespace is not provided that namespace is shared from the container's parent process
101
+
NamespacesNamespaces`json:"namespaces"`
102
+
103
+
// Capabilities specify the capabilities to keep when executing the process inside the container
104
+
// All capbilities not specified will be dropped from the processes capability mask
105
+
Capabilities []string`json:"capabilities"`
106
+
107
+
// Networks specifies the container's network setup to be created
108
+
Networks []*Network`json:"networks"`
109
+
110
+
// Routes can be specified to create entries in the route table as the container is started
111
+
Routes []*Route`json:"routes"`
112
+
113
+
// Cgroups specifies specific cgroup settings for the various subsystems that the container is
114
+
// placed into to limit the resources the container has available
115
+
Cgroups*Cgroup`json:"cgroups"`
116
+
117
+
// AppArmorProfile specifies the profile to apply to the process running in the container and is
118
+
// change at the time the process is execed
119
+
AppArmorProfilestring`json:"apparmor_profile"`
120
+
121
+
// ProcessLabel specifies the label to apply to the process running in the container. It is
122
+
// commonly used by selinux
123
+
ProcessLabelstring`json:"process_label"`
124
+
125
+
// Rlimits specifies the resource limits, such as max open files, to set in the container
126
+
// If Rlimits are not set, the container will inherit rlimits from the parent process
127
+
Rlimits []Rlimit`json:"rlimits"`
128
+
129
+
// OomScoreAdj specifies the adjustment to be made by the kernel when calculating oom scores
130
+
// for a process. Valid values are between the range [-1000, '1000'], where processes with
131
+
// higher scores are preferred for being killed.
132
+
// More information about kernel oom score calculation here: https://lwn.net/Articles/317814/
133
+
OomScoreAdjint`json:"oom_score_adj"`
134
+
135
+
// AdditionalGroups specifies the gids that should be added to supplementary groups
0 commit comments