Skip to content

Latest commit

 

History

History
673 lines (534 loc) · 26.5 KB

File metadata and controls

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