Skip to content

Latest commit

 

History

History
620 lines (485 loc) · 22.3 KB

File metadata and controls

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