Skip to content

Latest commit

 

History

History
641 lines (503 loc) · 23.4 KB

File metadata and controls

641 lines (503 loc) · 23.4 KB
 
Mar 2, 2017
Mar 2, 2017
1
# <a name="linuxContainerConfiguration" />Linux Container Configuration
Jun 25, 2015
Jun 25, 2015
2
May 2, 2016
May 2, 2016
3
This document describes the schema for the [Linux-specific section](config.md#platform-specific-configuration) of the [container configuration](config.md).
Aug 12, 2016
Aug 12, 2016
4
The Linux container specification uses various kernel features like namespaces, cgroups, capabilities, LSM, and filesystem jails to fulfill the spec.
Jun 30, 2015
Jun 30, 2015
5
Mar 2, 2017
Mar 2, 2017
6
## <a name="configLinuxDefaultFilesystems" />Default Filesystems
Sep 9, 2015
Sep 9, 2015
7
8
The Linux ABI includes both syscalls and several special file paths.
Oct 27, 2016
Oct 27, 2016
9
Applications expecting a Linux environment will very likely expect these file paths to be setup correctly.
Sep 9, 2015
Sep 9, 2015
10
Jan 23, 2017
Jan 23, 2017
11
The following filesystems SHOULD be made available in each container's filesystem:
Jan 27, 2016
Jan 27, 2016
12
Mar 3, 2017
Mar 3, 2017
13
| Path | Type |
Jan 27, 2016
Jan 27, 2016
14
| -------- | ------ |
Mar 3, 2017
Mar 3, 2017
15
| /proc | [procfs][procfs] |
16
| /sys | [sysfs][sysfs] |
17
| /dev/pts | [devpts][devpts] |
18
| /dev/shm | [tmpfs][tmpfs] |
Jan 27, 2016
Jan 27, 2016
19
Mar 2, 2017
Mar 2, 2017
20
## <a name="configLinuxNamespaces" />Namespaces
Jan 27, 2016
Jan 27, 2016
21
22
A namespace wraps a global system resource in an abstraction that makes it appear to the processes within the namespace that they have their own isolated instance of the global resource.
23
Changes to the global resource are visible to other processes that are members of the namespace, but are invisible to other processes.
Mar 3, 2017
Mar 3, 2017
24
For more information, see the [namespaces(7)][namespaces.7_2] man page.
Jan 27, 2016
Jan 27, 2016
25
26
Namespaces are specified as an array of entries inside the `namespaces` root field.
27
The following parameters can be specified to setup namespaces:
28
Oct 27, 2016
Oct 27, 2016
29
* **`type`** *(string, REQUIRED)* - namespace type. The following namespace types are supported:
Jun 3, 2016
Jun 3, 2016
30
* **`pid`** processes inside the container will only be able to see other processes inside the same container.
31
* **`network`** the container will have its own network stack.
32
* **`mount`** the container will have an isolated mount table.
33
* **`ipc`** processes inside the container will only be able to communicate to other processes inside the same container via system level IPC.
34
* **`uts`** the container will be able to have its own hostname and domain name.
35
* **`user`** the container will be able to remap user and group IDs from the host to local users and groups within the container.
36
* **`cgroup`** the container will have an isolated view of the cgroup hierarchy.
Jan 27, 2016
Jan 27, 2016
37
Sep 18, 2016
Sep 18, 2016
38
* **`path`** *(string, OPTIONAL)* - path to namespace file in the [runtime mount namespace](glossary.md#runtime-namespace)
Jan 27, 2016
Jan 27, 2016
39
40
If a path is specified, that particular file is used to join that type of namespace.
Aug 24, 2016
Aug 24, 2016
41
If a namespace type is not specified in the `namespaces` array, the container MUST inherit the [runtime namespace](glossary.md#runtime-namespace) of that type.
Oct 27, 2016
Oct 27, 2016
42
If a `namespaces` field contains duplicated namespaces with same `type`, the runtime MUST error out.
Jan 27, 2016
Jan 27, 2016
43
44
###### Example
45
46
```json
47
"namespaces": [
48
{
49
"type": "pid",
50
"path": "/proc/1234/ns/pid"
51
},
52
{
53
"type": "network",
54
"path": "/var/run/netns/neta"
55
},
56
{
57
"type": "mount"
58
},
59
{
60
"type": "ipc"
61
},
62
{
63
"type": "uts"
64
},
65
{
66
"type": "user"
Jun 3, 2016
Jun 3, 2016
67
},
68
{
69
"type": "cgroup"
Jan 27, 2016
Jan 27, 2016
70
}
71
]
72
```
73
Mar 2, 2017
Mar 2, 2017
74
## <a name="configLinuxUserNamespaceMappings" />User namespace mappings
Jan 27, 2016
Jan 27, 2016
75
Oct 27, 2016
Oct 27, 2016
76
**`uidMappings`** (array of objects, OPTIONAL) describes the user namespace uid mappings from the host to the container.
77
**`gidMappings`** (array of objects, OPTIONAL) describes the user namespace gid mappings from the host to the container.
78
Oct 28, 2016
Oct 28, 2016
79
Each entry has the following structure:
Oct 27, 2016
Oct 27, 2016
80
Feb 27, 2017
Feb 27, 2017
81
* **`hostID`** *(uint32, REQUIRED)* - is the starting uid/gid on the host to be mapped to *containerID*.
82
* **`containerID`** *(uint32, REQUIRED)* - is the starting uid/gid in the container.
83
* **`size`** *(uint32, REQUIRED)* - is the number of ids to be mapped.
Oct 27, 2016
Oct 27, 2016
84
85
The runtime SHOULD NOT modify the ownership of referenced filesystems to realize the mapping.
Feb 22, 2017
Feb 22, 2017
86
Note that the number of mapping entries MAY be limited by the [kernel][user-namespaces].
Oct 27, 2016
Oct 27, 2016
87
Jan 27, 2016
Jan 27, 2016
88
###### Example
89
90
```json
91
"uidMappings": [
92
{
93
"hostID": 1000,
94
"containerID": 0,
Nov 8, 2016
Nov 8, 2016
95
"size": 32000
Jan 27, 2016
Jan 27, 2016
96
}
97
],
98
"gidMappings": [
99
{
100
"hostID": 1000,
101
"containerID": 0,
Nov 8, 2016
Nov 8, 2016
102
"size": 32000
Jan 27, 2016
Jan 27, 2016
103
}
104
]
105
```
106
Mar 2, 2017
Mar 2, 2017
107
## <a name="configLinuxDevices" />Devices
Jan 27, 2016
Jan 27, 2016
108
Sep 30, 2016
Sep 30, 2016
109
**`devices`** (array of objects, OPTIONAL) lists devices that MUST be available in the container.
Jan 27, 2016
Jan 27, 2016
110
The runtime may supply them however it likes (with [mknod][mknod.2], by bind mounting from the runtime mount namespace, etc.).
Jan 27, 2016
Jan 27, 2016
111
Oct 28, 2016
Oct 28, 2016
112
Each entry has the following structure:
Jan 27, 2016
Jan 27, 2016
113
Sep 18, 2016
Sep 18, 2016
114
* **`type`** *(string, REQUIRED)* - type of device: `c`, `b`, `u` or `p`.
Jan 27, 2016
Jan 27, 2016
115
More info in [mknod(1)][mknod.1].
Sep 18, 2016
Sep 18, 2016
116
* **`path`** *(string, REQUIRED)* - full path to device inside container.
Jan 12, 2017
Jan 12, 2017
117
If a [file][file.1] already exists at `path` that does not match the requested device, the runtime MUST generate an error.
Feb 27, 2017
Feb 27, 2017
118
* **`major, minor`** *(int64, REQUIRED unless `type` is `p`)* - [major, minor numbers][devices] for the device.
Sep 18, 2016
Sep 18, 2016
119
* **`fileMode`** *(uint32, OPTIONAL)* - file mode for the device.
Jan 27, 2016
Jan 27, 2016
120
You can also control access to devices [with cgroups](#device-whitelist).
Sep 18, 2016
Sep 18, 2016
121
* **`uid`** *(uint32, OPTIONAL)* - id of device owner.
122
* **`gid`** *(uint32, OPTIONAL)* - id of device group.
Jan 27, 2016
Jan 27, 2016
123
Jan 12, 2017
Jan 12, 2017
124
The same `type`, `major` and `minor` SHOULD NOT be used for multiple devices.
125
Jan 27, 2016
Jan 27, 2016
126
###### Example
127
128
```json
129
"devices": [
130
{
Jan 27, 2016
Jan 27, 2016
131
"path": "/dev/fuse",
Jan 27, 2016
Jan 27, 2016
132
"type": "c",
Jan 27, 2016
Jan 27, 2016
133
"major": 10,
134
"minor": 229,
Feb 23, 2016
Feb 23, 2016
135
"fileMode": 438,
Jan 27, 2016
Jan 27, 2016
136
"uid": 0,
137
"gid": 0
138
},
139
{
Jan 27, 2016
Jan 27, 2016
140
"path": "/dev/sda",
141
"type": "b",
142
"major": 8,
Jan 27, 2016
Jan 27, 2016
143
"minor": 0,
Feb 23, 2016
Feb 23, 2016
144
"fileMode": 432,
Jan 27, 2016
Jan 27, 2016
145
"uid": 0,
146
"gid": 0
147
}
148
]
149
```
150
Mar 2, 2017
Mar 2, 2017
151
###### <a name="configLinuxDefaultDevices" />Default Devices
Jan 27, 2016
Jan 27, 2016
152
153
In addition to any devices configured with this setting, the runtime MUST also supply:
154
155
* [`/dev/null`][null.4]
156
* [`/dev/zero`][zero.4]
157
* [`/dev/full`][full.4]
158
* [`/dev/random`][random.4]
159
* [`/dev/urandom`][random.4]
160
* [`/dev/tty`][tty.4]
Oct 19, 2016
Oct 19, 2016
161
* [`/dev/console`][console.4] is setup if terminal is enabled in the config by bind mounting the pseudoterminal slave to /dev/console.
Jan 27, 2016
Jan 27, 2016
162
* [`/dev/ptmx`][pts.4].
163
A [bind-mount or symlink of the container's `/dev/pts/ptmx`][devpts].
164
Mar 2, 2017
Mar 2, 2017
165
## <a name="configLinuxControlGroups" />Control groups
Jan 27, 2016
Jan 27, 2016
166
167
Also known as cgroups, they are used to restrict resource usage for a container and handle device access.
Jul 21, 2016
Jul 21, 2016
168
cgroups provide controls (through controllers) to restrict cpu, memory, IO, pids and network for the container.
Jan 28, 2016
Jan 28, 2016
169
For more information, see the [kernel cgroups documentation][cgroup-v1].
Jan 27, 2016
Jan 27, 2016
170
171
The path to the cgroups can be specified in the Spec via `cgroupsPath`.
Jul 21, 2016
Jul 21, 2016
172
`cgroupsPath` can be used to either control the cgroup hierarchy for containers or to run a new process in an existing container.
Jul 22, 2016
Jul 22, 2016
173
If `cgroupsPath` is:
174
* ... an absolute path (starting with `/`), the runtime MUST take the path to be relative to the cgroup mount point.
175
* ... a relative path (not starting with `/`), the runtime MAY interpret the path relative to a runtime-determined location in the cgroup hierarchy.
176
* ... not specified, the runtime MAY define the default cgroup path.
177
Runtimes MAY consider certain `cgroupsPath` values to be invalid, and MUST generate an error if this is the case.
178
If a `cgroupsPath` value is specified, the runtime MUST consistently attach to the same place in the cgroup hierarchy given the same value of `cgroupsPath`.
179
Jan 27, 2016
Jan 27, 2016
180
Implementations of the Spec can choose to name cgroups in any manner.
181
The Spec does not include naming schema for cgroups.
Jul 21, 2016
Jul 21, 2016
182
The Spec does not support per-controller paths for the reasons discussed in the [cgroupv2 documentation][cgroup-v2].
Jan 27, 2016
Jan 27, 2016
183
The cgroups will be created if they don't exist.
184
Jul 21, 2016
Jul 21, 2016
185
You can configure a container's cgroups via the `resources` field of the Linux configuration.
186
Do not specify `resources` unless limits have to be updated.
187
For example, to run a new process in an existing container without updating limits, `resources` need not be specified.
188
Jul 22, 2016
Jul 22, 2016
189
A runtime MUST at least use the minimum set of cgroup controllers required to fulfill the `resources` settings.
190
However, a runtime MAY attach the container process to additional cgroup controllers supported by the system.
191
Jan 27, 2016
Jan 27, 2016
192
###### Example
193
194
```json
Jul 22, 2016
Jul 22, 2016
195
"cgroupsPath": "/myRuntime/myContainer",
196
"resources": {
197
"memory": {
198
"limit": 100000,
199
"reservation": 200000
200
},
201
"devices": [
202
{
203
"allow": false,
204
"access": "rwm"
205
}
206
]
207
}
Jan 27, 2016
Jan 27, 2016
208
```
209
Mar 2, 2017
Mar 2, 2017
210
#### <a name="configLinuxDeviceWhitelist" />Device whitelist
Jan 27, 2016
Jan 27, 2016
211
Sep 30, 2016
Sep 30, 2016
212
**`devices`** (array of objects, OPTIONAL) configures the [device whitelist][cgroup-v1-devices].
Jan 27, 2016
Jan 27, 2016
213
The runtime MUST apply entries in the listed order.
214
Oct 28, 2016
Oct 28, 2016
215
Each entry has the following structure:
Jan 27, 2016
Jan 27, 2016
216
Sep 18, 2016
Sep 18, 2016
217
* **`allow`** *(boolean, REQUIRED)* - whether the entry is allowed or denied.
Sep 18, 2016
Sep 18, 2016
218
* **`type`** *(string, OPTIONAL)* - type of device: `a` (all), `c` (char), or `b` (block).
Jan 27, 2016
Jan 27, 2016
219
`null` or unset values mean "all", mapping to `a`.
Sep 18, 2016
Sep 18, 2016
220
* **`major, minor`** *(int64, OPTIONAL)* - [major, minor numbers][devices] for the device.
Jan 28, 2016
Jan 28, 2016
221
`null` or unset values mean "all", mapping to [`*` in the filesystem API][cgroup-v1-devices].
Sep 18, 2016
Sep 18, 2016
222
* **`access`** *(string, OPTIONAL)* - cgroup permissions for device.
Jan 27, 2016
Jan 27, 2016
223
A composition of `r` (read), `w` (write), and `m` (mknod).
224
225
###### Example
226
227
```json
228
"devices": [
229
{
230
"allow": false,
231
"access": "rwm"
232
},
233
{
234
"allow": true,
235
"type": "c",
236
"major": 10,
237
"minor": 229,
238
"access": "rw"
239
},
240
{
241
"allow": true,
242
"type": "b",
243
"major": 8,
244
"minor": 0,
245
"access": "r"
246
}
247
]
248
```
249
Mar 2, 2017
Mar 2, 2017
250
#### <a name="configLinuxDisableOutOfMemoryKiller" />Disable out-of-memory killer
Jan 27, 2016
Jan 27, 2016
251
252
`disableOOMKiller` contains a boolean (`true` or `false`) that enables or disables the Out of Memory killer for a cgroup.
253
If enabled (`false`), tasks that attempt to consume more memory than they are allowed are immediately killed by the OOM killer.
254
The OOM killer is enabled by default in every cgroup using the `memory` subsystem.
255
To disable it, specify a value of `true`.
Jan 28, 2016
Jan 28, 2016
256
For more information, see [the memory cgroup man page][cgroup-v1-memory].
Jan 27, 2016
Jan 27, 2016
257
Sep 18, 2016
Sep 18, 2016
258
* **`disableOOMKiller`** *(bool, OPTIONAL)* - enables or disables the OOM killer
Jan 27, 2016
Jan 27, 2016
259
260
###### Example
261
262
```json
263
"disableOOMKiller": false
264
```
265
Mar 2, 2017
Mar 2, 2017
266
#### <a name="configLinuxSetOomScoreAdj" />Set oom_score_adj
Jan 27, 2016
Jan 27, 2016
267
268
`oomScoreAdj` sets heuristic regarding how the process is evaluated by the kernel during memory pressure.
Mar 3, 2017
Mar 3, 2017
269
For more information, see [the proc filesystem documentation section 3.1][procfs].
Jan 27, 2016
Jan 27, 2016
270
This is a kernel/system level setting, where as `disableOOMKiller` is scoped for a memory cgroup.
Jan 28, 2016
Jan 28, 2016
271
For more information on how these two settings work together, see [the memory cgroup documentation section 10. OOM Contol][cgroup-v1-memory].
Jan 27, 2016
Jan 27, 2016
272
Sep 18, 2016
Sep 18, 2016
273
* **`oomScoreAdj`** *(int, OPTIONAL)* - adjust the oom-killer score
Jan 27, 2016
Jan 27, 2016
274
275
###### Example
276
277
```json
Apr 11, 2016
Apr 11, 2016
278
"oomScoreAdj": 100
Jan 27, 2016
Jan 27, 2016
279
```
280
Mar 2, 2017
Mar 2, 2017
281
#### <a name="configLinuxMemory" />Memory
Jan 27, 2016
Jan 27, 2016
282
Sep 30, 2016
Sep 30, 2016
283
**`memory`** (object, OPTIONAL) represents the cgroup subsystem `memory` and it's used to set limits on the container's memory usage.
Jan 28, 2016
Jan 28, 2016
284
For more information, see [the memory cgroup man page][cgroup-v1-memory].
Jan 27, 2016
Jan 27, 2016
285
286
The following parameters can be specified to setup the controller:
287
Mar 1, 2017
Mar 1, 2017
288
* **`limit`** *(uint64, OPTIONAL)* - sets limit of memory usage in bytes
Jan 27, 2016
Jan 27, 2016
289
Mar 1, 2017
Mar 1, 2017
290
* **`reservation`** *(uint64, OPTIONAL)* - sets soft limit of memory usage in bytes
Jan 27, 2016
Jan 27, 2016
291
Mar 1, 2017
Mar 1, 2017
292
* **`swap`** *(uint64, OPTIONAL)* - sets limit of memory+Swap usage
Jan 27, 2016
Jan 27, 2016
293
Mar 1, 2017
Mar 1, 2017
294
* **`kernel`** *(uint64, OPTIONAL)* - sets hard limit for kernel memory
Jan 27, 2016
Jan 27, 2016
295
Mar 1, 2017
Mar 1, 2017
296
* **`kernelTCP`** *(uint64, OPTIONAL)* - sets hard limit in bytes for kernel TCP buffer memory
Jan 27, 2016
Jan 27, 2016
297
Sep 18, 2016
Sep 18, 2016
298
* **`swappiness`** *(uint64, OPTIONAL)* - sets swappiness parameter of vmscan (See sysctl's vm.swappiness)
Jan 27, 2016
Jan 27, 2016
299
300
###### Example
301
302
```json
303
"memory": {
Apr 11, 2016
Apr 11, 2016
304
"limit": 536870912,
305
"reservation": 536870912,
306
"swap": 536870912,
Jan 27, 2016
Jan 27, 2016
307
"kernel": 0,
308
"kernelTCP": 0,
309
"swappiness": 0
310
}
311
```
312
Mar 2, 2017
Mar 2, 2017
313
#### <a name="configLinuxCPU" />CPU
Jan 27, 2016
Jan 27, 2016
314
Sep 30, 2016
Sep 30, 2016
315
**`cpu`** (object, OPTIONAL) represents the cgroup subsystems `cpu` and `cpusets`.
Jan 28, 2016
Jan 28, 2016
316
For more information, see [the cpusets cgroup man page][cgroup-v1-cpusets].
Jan 27, 2016
Jan 27, 2016
317
318
The following parameters can be specified to setup the controller:
319
Sep 18, 2016
Sep 18, 2016
320
* **`shares`** *(uint64, OPTIONAL)* - specifies a relative share of CPU time available to the tasks in a cgroup
Jan 27, 2016
Jan 27, 2016
321
Jan 5, 2017
Jan 5, 2017
322
* **`quota`** *(int64, OPTIONAL)* - specifies the total amount of time in microseconds for which all tasks in a cgroup can run during one period (as defined by **`period`** below)
Jan 27, 2016
Jan 27, 2016
323
Sep 18, 2016
Sep 18, 2016
324
* **`period`** *(uint64, OPTIONAL)* - specifies a period of time in microseconds for how regularly a cgroup's access to CPU resources should be reallocated (CFS scheduler only)
Jan 27, 2016
Jan 27, 2016
325
Jan 5, 2017
Jan 5, 2017
326
* **`realtimeRuntime`** *(int64, OPTIONAL)* - specifies a period of time in microseconds for the longest continuous period in which the tasks in a cgroup have access to CPU resources
Jan 27, 2016
Jan 27, 2016
327
Sep 18, 2016
Sep 18, 2016
328
* **`realtimePeriod`** *(uint64, OPTIONAL)* - same as **`period`** but applies to realtime scheduler only
Jan 27, 2016
Jan 27, 2016
329
Sep 18, 2016
Sep 18, 2016
330
* **`cpus`** *(string, OPTIONAL)* - list of CPUs the container will run in
Jan 27, 2016
Jan 27, 2016
331
Sep 18, 2016
Sep 18, 2016
332
* **`mems`** *(string, OPTIONAL)* - list of Memory Nodes the container will run in
Jan 27, 2016
Jan 27, 2016
333
334
###### Example
335
336
```json
337
"cpu": {
Apr 11, 2016
Apr 11, 2016
338
"shares": 1024,
339
"quota": 1000000,
340
"period": 500000,
341
"realtimeRuntime": 950000,
342
"realtimePeriod": 1000000,
343
"cpus": "2-3",
344
"mems": "0-7"
Jan 27, 2016
Jan 27, 2016
345
}
346
```
347
Mar 2, 2017
Mar 2, 2017
348
#### <a name="configLinuxBlockIO" />Block IO
Jan 27, 2016
Jan 27, 2016
349
Oct 27, 2016
Oct 27, 2016
350
**`blockIO`** (object, OPTIONAL) represents the cgroup subsystem `blkio` which implements the block IO controller.
Jan 28, 2016
Jan 28, 2016
351
For more information, see [the kernel cgroups documentation about blkio][cgroup-v1-blkio].
Jan 27, 2016
Jan 27, 2016
352
353
The following parameters can be specified to setup the controller:
354
Sep 18, 2016
Sep 18, 2016
355
* **`blkioWeight`** *(uint16, OPTIONAL)* - specifies per-cgroup weight. This is default weight of the group on all devices until and unless overridden by per-device rules. The range is from 10 to 1000.
Jan 27, 2016
Jan 27, 2016
356
Sep 18, 2016
Sep 18, 2016
357
* **`blkioLeafWeight`** *(uint16, OPTIONAL)* - equivalents of `blkioWeight` for the purpose of deciding how much weight tasks in the given cgroup has while competing with the cgroup's child cgroups. The range is from 10 to 1000.
Jan 27, 2016
Jan 27, 2016
358
Sep 18, 2016
Sep 18, 2016
359
* **`blkioWeightDevice`** *(array, OPTIONAL)* - specifies the list of devices which will be bandwidth rate limited. The following parameters can be specified per-device:
Sep 18, 2016
Sep 18, 2016
360
* **`major, minor`** *(int64, REQUIRED)* - major, minor numbers for device. More info in `man mknod`.
Sep 18, 2016
Sep 18, 2016
361
* **`weight`** *(uint16, OPTIONAL)* - bandwidth rate for the device, range is from 10 to 1000
362
* **`leafWeight`** *(uint16, OPTIONAL)* - bandwidth rate for the device while competing with the cgroup's child cgroups, range is from 10 to 1000, CFQ scheduler only
Jan 27, 2016
Jan 27, 2016
363
364
You must specify at least one of `weight` or `leafWeight` in a given entry, and can specify both.
365
Nov 3, 2016
Nov 3, 2016
366
* **`blkioThrottleReadBpsDevice`**, **`blkioThrottleWriteBpsDevice`**, **`blkioThrottleReadIOPSDevice`**, **`blkioThrottleWriteIOPSDevice`** *(array, OPTIONAL)* - specify the list of devices which will be IO rate limited.
367
The following parameters can be specified per-device:
Sep 18, 2016
Sep 18, 2016
368
* **`major, minor`** *(int64, REQUIRED)* - major, minor numbers for device. More info in `man mknod`.
369
* **`rate`** *(uint64, REQUIRED)* - IO rate limit for the device
Jan 27, 2016
Jan 27, 2016
370
371
###### Example
372
373
```json
374
"blockIO": {
Apr 11, 2016
Apr 11, 2016
375
"blkioWeight": 10,
376
"blkioLeafWeight": 10,
Jan 27, 2016
Jan 27, 2016
377
"blkioWeightDevice": [
378
{
379
"major": 8,
380
"minor": 0,
381
"weight": 500,
382
"leafWeight": 300
383
},
384
{
385
"major": 8,
386
"minor": 16,
387
"weight": 500
388
}
389
],
390
"blkioThrottleReadBpsDevice": [
391
{
392
"major": 8,
393
"minor": 0,
394
"rate": 600
395
}
396
],
397
"blkioThrottleWriteIOPSDevice": [
398
{
399
"major": 8,
400
"minor": 16,
401
"rate": 300
402
}
403
]
404
}
405
```
406
Mar 2, 2017
Mar 2, 2017
407
#### <a name="configLinuxHugePageLimits" />Huge page limits
Jan 27, 2016
Jan 27, 2016
408
Sep 30, 2016
Sep 30, 2016
409
**`hugepageLimits`** (array of objects, OPTIONAL) represents the `hugetlb` controller which allows to limit the
Jan 27, 2016
Jan 27, 2016
410
HugeTLB usage per control group and enforces the controller limit during page fault.
Jan 28, 2016
Jan 28, 2016
411
For more information, see the [kernel cgroups documentation about HugeTLB][cgroup-v1-hugetlb].
Jan 27, 2016
Jan 27, 2016
412
Sep 30, 2016
Sep 30, 2016
413
Each entry has the following structure:
Jan 27, 2016
Jan 27, 2016
414
Sep 18, 2016
Sep 18, 2016
415
* **`pageSize`** *(string, REQUIRED)* - hugepage size
Jan 27, 2016
Jan 27, 2016
416
Mar 1, 2017
Mar 1, 2017
417
* **`limit`** *(uint64, REQUIRED)* - limit in bytes of *hugepagesize* HugeTLB usage
Jan 27, 2016
Jan 27, 2016
418
419
###### Example
420
421
```json
422
"hugepageLimits": [
423
{
424
"pageSize": "2MB",
Jan 5, 2017
Jan 5, 2017
425
"limit": 209715200
Jan 27, 2016
Jan 27, 2016
426
}
427
]
428
```
429
Mar 2, 2017
Mar 2, 2017
430
#### <a name="configLinuxNetwork" />Network
Jan 27, 2016
Jan 27, 2016
431
Sep 30, 2016
Sep 30, 2016
432
**`network`** (object, OPTIONAL) represents the cgroup subsystems `net_cls` and `net_prio`.
Jan 28, 2016
Jan 28, 2016
433
For more information, see [the net\_cls cgroup man page][cgroup-v1-net-cls] and [the net\_prio cgroup man page][cgroup-v1-net-prio].
Jan 27, 2016
Jan 27, 2016
434
Oct 28, 2016
Oct 28, 2016
435
The following parameters can be specified to setup the controller:
Jan 27, 2016
Jan 27, 2016
436
Sep 18, 2016
Sep 18, 2016
437
* **`classID`** *(uint32, OPTIONAL)* - is the network class identifier the cgroup's network packets will be tagged with
Jan 27, 2016
Jan 27, 2016
438
Nov 3, 2016
Nov 3, 2016
439
* **`priorities`** *(array, OPTIONAL)* - specifies a list of objects of the priorities assigned to traffic originating from processes in the group and egressing the system on various interfaces.
440
The following parameters can be specified per-priority:
Sep 18, 2016
Sep 18, 2016
441
* **`name`** *(string, REQUIRED)* - interface name
442
* **`priority`** *(uint32, REQUIRED)* - priority applied to the interface
Jan 27, 2016
Jan 27, 2016
443
444
###### Example
445
446
```json
447
"network": {
448
"classID": 1048577,
449
"priorities": [
450
{
451
"name": "eth0",
452
"priority": 500
453
},
454
{
455
"name": "eth1",
456
"priority": 1000
457
}
458
]
459
}
460
```
461
Mar 2, 2017
Mar 2, 2017
462
#### <a name="configLinuxPIDS" />PIDs
Jan 27, 2016
Jan 27, 2016
463
Sep 30, 2016
Sep 30, 2016
464
**`pids`** (object, OPTIONAL) represents the cgroup subsystem `pids`.
Jan 28, 2016
Jan 28, 2016
465
For more information, see [the pids cgroup man page][cgroup-v1-pids].
Jan 27, 2016
Jan 27, 2016
466
Mar 21, 2016
Mar 21, 2016
467
The following parameters can be specified to setup the controller:
Jan 27, 2016
Jan 27, 2016
468
Sep 18, 2016
Sep 18, 2016
469
* **`limit`** *(int64, REQUIRED)* - specifies the maximum number of tasks in the cgroup
Jan 27, 2016
Jan 27, 2016
470
471
###### Example
472
473
```json
474
"pids": {
475
"limit": 32771
476
}
477
```
478
Mar 2, 2017
Mar 2, 2017
479
## <a name="configLinuxSysctl" />Sysctl
Jan 27, 2016
Jan 27, 2016
480
Sep 30, 2016
Sep 30, 2016
481
**`sysctl`** (object, OPTIONAL) allows kernel parameters to be modified at runtime for the container.
Mar 3, 2017
Mar 3, 2017
482
For more information, see the [sysctl(8)][sysctl.8] man page.
Jan 27, 2016
Jan 27, 2016
483
484
###### Example
485
486
```json
487
"sysctl": {
488
"net.ipv4.ip_forward": "1",
489
"net.core.somaxconn": "256"
490
}
491
```
492
Mar 2, 2017
Mar 2, 2017
493
## <a name="configLinuxSeccomp" />Seccomp
Jan 27, 2016
Jan 27, 2016
494
495
Seccomp provides application sandboxing mechanism in the Linux kernel.
496
Seccomp configuration allows one to configure actions to take for matched syscalls and furthermore also allows matching on values passed as arguments to syscalls.
Mar 3, 2017
Mar 3, 2017
497
For more information about Seccomp, see [Seccomp][seccomp] kernel documentation.
498
The actions, architectures, and operators are strings that match the definitions in seccomp.h from [libseccomp][] and are translated to corresponding values.
Mar 2, 2017
Mar 2, 2017
499
A valid list of constants as of libseccomp v2.3.2 is shown below.
Jan 27, 2016
Jan 27, 2016
500
501
Architecture Constants
502
* `SCMP_ARCH_X86`
503
* `SCMP_ARCH_X86_64`
504
* `SCMP_ARCH_X32`
505
* `SCMP_ARCH_ARM`
506
* `SCMP_ARCH_AARCH64`
507
* `SCMP_ARCH_MIPS`
508
* `SCMP_ARCH_MIPS64`
509
* `SCMP_ARCH_MIPS64N32`
510
* `SCMP_ARCH_MIPSEL`
511
* `SCMP_ARCH_MIPSEL64`
512
* `SCMP_ARCH_MIPSEL64N32`
Jun 22, 2016
Jun 22, 2016
513
* `SCMP_ARCH_PPC`
514
* `SCMP_ARCH_PPC64`
515
* `SCMP_ARCH_PPC64LE`
516
* `SCMP_ARCH_S390`
517
* `SCMP_ARCH_S390X`
Mar 2, 2017
Mar 2, 2017
518
* `SCMP_ARCH_PARISC`
519
* `SCMP_ARCH_PARISC64`
Jan 27, 2016
Jan 27, 2016
520
521
Action Constants:
522
* `SCMP_ACT_KILL`
523
* `SCMP_ACT_TRAP`
524
* `SCMP_ACT_ERRNO`
525
* `SCMP_ACT_TRACE`
526
* `SCMP_ACT_ALLOW`
527
528
Operator Constants:
529
* `SCMP_CMP_NE`
530
* `SCMP_CMP_LT`
531
* `SCMP_CMP_LE`
532
* `SCMP_CMP_EQ`
533
* `SCMP_CMP_GE`
534
* `SCMP_CMP_GT`
535
* `SCMP_CMP_MASKED_EQ`
536
537
###### Example
538
539
```json
540
"seccomp": {
541
"defaultAction": "SCMP_ACT_ALLOW",
542
"architectures": [
Feb 22, 2017
Feb 22, 2017
543
"SCMP_ARCH_X86",
544
"SCMP_ARCH_X32"
Jan 27, 2016
Jan 27, 2016
545
],
546
"syscalls": [
547
{
Feb 22, 2017
Feb 22, 2017
548
"names": [
549
"getcwd",
550
"chmod"
551
],
552
"action": "SCMP_ACT_ERRNO",
553
"comment": "stop exploit x"
Jan 27, 2016
Jan 27, 2016
554
}
555
]
556
}
557
```
558
Mar 2, 2017
Mar 2, 2017
559
## <a name="configLinuxRootfsMountPropagation" />Rootfs Mount Propagation
Jan 27, 2016
Jan 27, 2016
560
Sep 30, 2016
Sep 30, 2016
561
**`rootfsPropagation`** (string, OPTIONAL) sets the rootfs's mount propagation.
Jan 27, 2016
Jan 27, 2016
562
Its value is either slave, private, or shared.
Mar 3, 2017
Mar 3, 2017
563
The [Shared Subtrees][sharedsubtree] article in the kernel documentation has more information about mount propagation.
Jan 27, 2016
Jan 27, 2016
564
565
###### Example
566
567
```json
568
"rootfsPropagation": "slave",
569
```
570
Mar 2, 2017
Mar 2, 2017
571
## <a name="configLinuxMaskedPaths" />Masked Paths
Apr 1, 2016
Apr 1, 2016
572
Sep 30, 2016
Sep 30, 2016
573
**`maskedPaths`** (array of strings, OPTIONAL) will mask over the provided paths inside the container so that they cannot be read.
Nov 16, 2016
Nov 16, 2016
574
The values MUST be absolute paths in the [container namespace][container-namespace2].
Apr 1, 2016
Apr 1, 2016
575
576
###### Example
577
578
```json
579
"maskedPaths": [
580
"/proc/kcore"
581
]
582
```
583
Mar 2, 2017
Mar 2, 2017
584
## <a name="configLinuxReadonlyPaths" />Readonly Paths
Apr 1, 2016
Apr 1, 2016
585
Sep 30, 2016
Sep 30, 2016
586
**`readonlyPaths`** (array of strings, OPTIONAL) will set the provided paths as readonly inside the container.
Nov 16, 2016
Nov 16, 2016
587
The values MUST be absolute paths in the [container namespace][container-namespace2].
Apr 1, 2016
Apr 1, 2016
588
589
###### Example
590
591
```json
592
"readonlyPaths": [
593
"/proc/sys"
594
]
595
```
596
Mar 2, 2017
Mar 2, 2017
597
## <a name"configLinuxMountLabel" />Mount Label
Apr 22, 2016
Apr 22, 2016
598
Sep 30, 2016
Sep 30, 2016
599
**`mountLabel`** (string, OPTIONAL) will set the Selinux context for the mounts in the container.
Apr 22, 2016
Apr 22, 2016
600
601
###### Example
602
603
```json
604
"mountLabel": "system_u:object_r:svirt_sandbox_file_t:s0:c715,c811"
605
```
606
Mar 3, 2017
Mar 3, 2017
607
Nov 16, 2016
Nov 16, 2016
608
[container-namespace2]: glossary.md#container_namespace
Mar 3, 2017
Mar 3, 2017
609
Jan 28, 2016
Jan 28, 2016
610
[cgroup-v1]: https://www.kernel.org/doc/Documentation/cgroup-v1/cgroups.txt
611
[cgroup-v1-blkio]: https://www.kernel.org/doc/Documentation/cgroup-v1/blkio-controller.txt
612
[cgroup-v1-cpusets]: https://www.kernel.org/doc/Documentation/cgroup-v1/cpusets.txt
613
[cgroup-v1-devices]: https://www.kernel.org/doc/Documentation/cgroup-v1/devices.txt
614
[cgroup-v1-hugetlb]: https://www.kernel.org/doc/Documentation/cgroup-v1/hugetlb.txt
615
[cgroup-v1-memory]: https://www.kernel.org/doc/Documentation/cgroup-v1/memory.txt
616
[cgroup-v1-net-cls]: https://www.kernel.org/doc/Documentation/cgroup-v1/net_cls.txt
617
[cgroup-v1-net-prio]: https://www.kernel.org/doc/Documentation/cgroup-v1/net_prio.txt
618
[cgroup-v1-pids]: https://www.kernel.org/doc/Documentation/cgroup-v1/pids.txt
619
[cgroup-v2]: https://www.kernel.org/doc/Documentation/cgroup-v2.txt
Jan 27, 2016
Jan 27, 2016
620
[devices]: https://www.kernel.org/doc/Documentation/devices.txt
621
[devpts]: https://www.kernel.org/doc/Documentation/filesystems/devpts.txt
Mar 3, 2017
Mar 3, 2017
622
[file]: http://pubs.opengroup.org/onlinepubs/9699919799/basedefs/V1_chap03.html#tag_03_164
623
[libseccomp]: https://github.com/seccomp/libseccomp
624
[procfs]: https://www.kernel.org/doc/Documentation/filesystems/proc.txt
625
[seccomp]: https://www.kernel.org/doc/Documentation/prctl/seccomp_filter.txt
626
[sharedsubtree]: https://www.kernel.org/doc/Documentation/filesystems/sharedsubtree.txt
627
[sysfs]: https://www.kernel.org/doc/Documentation/filesystems/sysfs.txt
628
[tmpfs]: https://www.kernel.org/doc/Documentation/filesystems/tmpfs.txt
Jan 27, 2016
Jan 27, 2016
629
630
[console.4]: http://man7.org/linux/man-pages/man4/console.4.html
631
[full.4]: http://man7.org/linux/man-pages/man4/full.4.html
Mar 3, 2017
Mar 3, 2017
632
[mknod.1]: http://man7.org/linux/man-pages/man1/mknod.1.html
633
[mknod.2]: http://man7.org/linux/man-pages/man2/mknod.2.html
634
[namespaces.7_2]: http://man7.org/linux/man-pages/man7/namespaces.7.html
Jan 27, 2016
Jan 27, 2016
635
[null.4]: http://man7.org/linux/man-pages/man4/null.4.html
636
[pts.4]: http://man7.org/linux/man-pages/man4/pts.4.html
637
[random.4]: http://man7.org/linux/man-pages/man4/random.4.html
Mar 3, 2017
Mar 3, 2017
638
[sysctl.8]: http://man7.org/linux/man-pages/man8/sysctl.8.html
Jan 27, 2016
Jan 27, 2016
639
[tty.4]: http://man7.org/linux/man-pages/man4/tty.4.html
640
[zero.4]: http://man7.org/linux/man-pages/man4/zero.4.html
Feb 22, 2017
Feb 22, 2017
641
[user-namespaces]: http://man7.org/linux/man-pages/man7/user_namespaces.7.html