Skip to content

Latest commit

 

History

History
777 lines (695 loc) · 25.9 KB

config.md

File metadata and controls

777 lines (695 loc) · 25.9 KB
 
Sep 25, 2015
Sep 25, 2015
1
# Container Configuration file
Jun 25, 2015
Jun 25, 2015
2
Aug 26, 2015
Aug 26, 2015
3
The container's top-level directory MUST contain a configuration file called `config.json`.
Jul 19, 2016
Jul 19, 2016
4
The canonical schema is defined in this document, but there is a JSON Schema in [`schema/config-schema.json`](schema/config-schema.json) and Go bindings in [`specs-go/config.go`](specs-go/config.go).
Jun 25, 2015
Jun 25, 2015
5
Jun 30, 2015
Jun 30, 2015
6
7
The configuration file contains metadata necessary to implement standard operations against the container.
This includes the process to run, environment variables to inject, sandboxing features to use, etc.
Jun 25, 2015
Jun 25, 2015
8
9
10
Below is a detailed description of each field defined in the configuration format.
Jan 15, 2016
Jan 15, 2016
11
## Specification version
Jun 25, 2015
Jun 25, 2015
12
Sep 18, 2016
Sep 18, 2016
13
* **`ociVersion`** (string, REQUIRED) MUST be in [SemVer v2.0.0](http://semver.org/spec/v2.0.0.html) format and specifies the version of the Open Container Runtime Specification with which the bundle complies.
Aug 3, 2016
Aug 3, 2016
14
The Open Container Runtime Specification follows semantic versioning and retains forward and backward compatibility within major versions.
Sep 14, 2016
Sep 14, 2016
15
For example, if a configuration is compliant with version 1.1 of this specification, it is compatible with all runtimes that support any 1.1 or later release of this specification, but is not compatible with a runtime that supports 1.0 and not 1.1.
Jun 25, 2015
Jun 25, 2015
16
Apr 8, 2016
Apr 8, 2016
17
### Example
Jun 30, 2015
Jun 30, 2015
18
Jun 29, 2015
Jun 29, 2015
19
```json
Jan 15, 2016
Jan 15, 2016
20
"ociVersion": "0.1.0"
Jun 25, 2015
Jun 25, 2015
21
22
```
Jun 30, 2015
Jun 30, 2015
23
## Root Configuration
Jun 25, 2015
Jun 25, 2015
24
Sep 18, 2016
Sep 18, 2016
25
**`root`** (object, REQUIRED) configures the container's root filesystem.
Jul 1, 2015
Jul 1, 2015
26
Sep 18, 2016
Sep 18, 2016
27
* **`path`** (string, REQUIRED) Specifies the path to the root filesystem for the container.
Sep 9, 2016
Sep 9, 2016
28
29
The path can be an absolute path (starting with /) or a relative path (not starting with /), which is relative to the bundle.
For example (Linux), with a bundle at `/to/bundle` and a root filesystem at `/to/bundle/rootfs`, the `path` value can be either `/to/bundle/rootfs` or `rootfs`.
Jul 22, 2016
Jul 22, 2016
30
A directory MUST exist at the path declared by the field.
Sep 18, 2016
Sep 18, 2016
31
* **`readonly`** (bool, OPTIONAL) If true then the root filesystem MUST be read-only inside the container, defaults to false.
Jun 25, 2015
Jun 25, 2015
32
Apr 8, 2016
Apr 8, 2016
33
### Example
Jun 30, 2015
Jun 30, 2015
34
Jun 29, 2015
Jun 29, 2015
35
```json
Jun 30, 2015
Jun 30, 2015
36
37
38
39
"root": {
"path": "rootfs",
"readonly": true
}
Jun 25, 2015
Jun 25, 2015
40
41
```
Jan 27, 2016
Jan 27, 2016
42
## Mounts
Sep 3, 2015
Sep 3, 2015
43
Sep 18, 2016
Sep 18, 2016
44
**`mounts`** (array, OPTIONAL) configures additional mounts (on top of [`root`](#root-configuration)).
Sep 11, 2015
Sep 11, 2015
45
The runtime MUST mount entries in the listed order.
Jan 27, 2016
Jan 27, 2016
46
The parameters are similar to the ones in [the Linux mount system call](http://man7.org/linux/man-pages/man2/mount.2.html).
Oct 12, 2016
Oct 12, 2016
47
For Solaris, the mounts corresponds to fs resource in zonecfg(8).
Sep 3, 2015
Sep 3, 2015
48
Sep 18, 2016
Sep 18, 2016
49
* **`destination`** (string, REQUIRED) Destination of mount point: path inside container.
Nov 4, 2016
Nov 4, 2016
50
This value MUST be an absolute path.
Jul 22, 2016
Jul 22, 2016
51
For the Windows operating system, one mount destination MUST NOT be nested within another mount (e.g., c:\\foo and c:\\foo\\bar).
Oct 12, 2016
Oct 12, 2016
52
For the Solaris operating system, this corresponds to "dir" of the fs resource in zonecfg(8).
Sep 18, 2016
Sep 18, 2016
53
* **`type`** (string, REQUIRED) The filesystem type of the filesystem to be mounted.
Jul 22, 2016
Jul 22, 2016
54
55
Linux: *filesystemtype* argument supported by the kernel are listed in */proc/filesystems* (e.g., "minix", "ext2", "ext3", "jfs", "xfs", "reiserfs", "msdos", "proc", "nfs", "iso9660").
Windows: ntfs.
Oct 12, 2016
Oct 12, 2016
56
Solaris: corresponds to "type" of the fs resource in zonecfg(8).
Sep 18, 2016
Sep 18, 2016
57
* **`source`** (string, REQUIRED) A device name, but can also be a directory name or a dummy.
Jul 22, 2016
Jul 22, 2016
58
Windows: the volume name that is the target of the mount point, \\?\Volume\{GUID}\ (on Windows source is called target).
Oct 12, 2016
Oct 12, 2016
59
Solaris: corresponds to "special" of the fs resource in zonecfg(8).
Sep 18, 2016
Sep 18, 2016
60
* **`options`** (list of strings, OPTIONAL) Mount options of the filesystem to be used.
Jul 22, 2016
Jul 22, 2016
61
Linux: [supported][mount.8-filesystem-independent] [options][mount.8-filesystem-specific] are listed in [mount(8)][mount.8].
Oct 12, 2016
Oct 12, 2016
62
Solaris: corresponds to "options" of the fs resource in zonecfg(8).
Sep 3, 2015
Sep 3, 2015
63
Apr 8, 2016
Apr 8, 2016
64
### Example (Linux)
Sep 3, 2015
Sep 3, 2015
65
66
67
68
```json
"mounts": [
{
Jan 27, 2016
Jan 27, 2016
69
70
71
72
"destination": "/tmp",
"type": "tmpfs",
"source": "tmpfs",
"options": ["nosuid","strictatime","mode=755","size=65536k"]
Sep 3, 2015
Sep 3, 2015
73
74
},
{
Jan 27, 2016
Jan 27, 2016
75
76
77
78
"destination": "/data",
"type": "bind",
"source": "/volumes/testing",
"options": ["rbind","rw"]
Sep 3, 2015
Sep 3, 2015
79
80
81
82
}
]
```
Apr 8, 2016
Apr 8, 2016
83
### Example (Windows)
Jan 27, 2016
Jan 27, 2016
84
85
86
87
88
89
90
91
92
93
94
95
96
97
```json
"mounts": [
"myfancymountpoint": {
"destination": "C:\\Users\\crosbymichael\\My Fancy Mount Point\\",
"type": "ntfs",
"source": "\\\\?\\Volume\\{2eca078d-5cbc-43d3-aff8-7e8511f60d0e}\\",
"options": []
}
]
```
See links for details about [mountvol](http://ss64.com/nt/mountvol.html) and [SetVolumeMountPoint](https://msdn.microsoft.com/en-us/library/windows/desktop/aa365561(v=vs.85).aspx) in Windows.
Oct 12, 2016
Oct 12, 2016
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
### Example (Solaris)
```json
"mounts": [
{
"destination": "/opt/local",
"type": "lofs",
"source": "/usr/local",
"options": ["ro","nodevices"]
},
{
"destination": "/opt/sfw",
"type": "lofs",
"source": "/opt/sfw"
}
]
```
Jan 27, 2016
Jan 27, 2016
116
Nov 11, 2016
Nov 11, 2016
117
## Process
Jun 25, 2015
Jun 25, 2015
118
Sep 18, 2016
Sep 18, 2016
119
**`process`** (object, REQUIRED) configures the container process.
Aug 3, 2016
Aug 3, 2016
120
Nov 10, 2016
Nov 10, 2016
121
* **`terminal`** (bool, OPTIONAL) specifies whether a terminal is attached to that process, defaults to false.
Oct 19, 2016
Oct 19, 2016
122
On Linux, a pseudoterminal pair is allocated for the container process and the pseudoterminal slave is duplicated on the container process's [standard streams][stdin.3].
Sep 20, 2016
Sep 20, 2016
123
124
125
* **`consoleSize`** (object, OPTIONAL) specifies the console size of the terminal if attached, containing the following properties:
* **`height`** (uint, REQUIRED)
* **`width`** (uint, REQUIRED)
Sep 18, 2016
Sep 18, 2016
126
* **`cwd`** (string, REQUIRED) is the working directory that will be set for the executable.
Jul 22, 2016
Jul 22, 2016
127
This value MUST be an absolute path.
Jan 4, 2017
Jan 4, 2017
128
* **`env`** (array of strings, OPTIONAL) with the same semantics as [IEEE Std 1003.1-2001's `environ`][ieee-1003.1-2001-xbd-c8.1].
Jan 4, 2017
Jan 4, 2017
129
130
* **`args`** (array of strings, REQUIRED) with similar semantics to [IEEE Std 1003.1-2001 `execvp`'s *argv*][ieee-1003.1-2001-xsh-exec].
This specification extends the IEEE standard in that at least one entry is REQUIRED, and that entry is used with the same semantics as `execvp`'s *file*.
Jun 25, 2015
Jun 25, 2015
131
Mar 10, 2016
Mar 10, 2016
132
For Linux-based systems the process structure supports the following process specific fields:
Mar 2, 2016
Mar 2, 2016
133
Sep 18, 2016
Sep 18, 2016
134
* **`capabilities`** (array of strings, OPTIONAL) capabilities is an array that specifies Linux capabilities that can be provided to the process inside the container.
Nov 3, 2016
Nov 3, 2016
135
136
137
138
139
140
141
142
143
144
145
Valid values are the strings for capabilities defined in [the man page](http://man7.org/linux/man-pages/man7/capabilities.7.html).
* **`rlimits`** (array of objects, OPTIONAL) allows setting resource limits for a process inside the container.
Each entry has the following structure:
* **`type`** (string, REQUIRED) - the 'type' field are the resources defined in [the man page](http://man7.org/linux/man-pages/man2/setrlimit.2.html).
* **`soft`** (uint64, REQUIRED) - the value that the kernel enforces for the corresponding resource.
* **`hard`** (uint64, REQUIRED) - the ceiling for the soft limit that could be set by an unprivileged process.
Only privileged process (under Linux: one with the CAP_SYS_RESOURCE capability) can raise a hard limit.
If `rlimits` contains duplicated entries with same `type`, the runtime MUST error out.
Sep 18, 2016
Sep 18, 2016
146
* **`apparmorProfile`** (string, OPTIONAL) apparmor profile specifies the name of the apparmor profile that will be used for the container.
Nov 3, 2016
Nov 3, 2016
147
For more information about Apparmor, see [Apparmor documentation](https://wiki.ubuntu.com/AppArmor)
Sep 18, 2016
Sep 18, 2016
148
* **`selinuxLabel`** (string, OPTIONAL) SELinux process label specifies the label with which the processes in a container are run.
Nov 3, 2016
Nov 3, 2016
149
For more information about SELinux, see [Selinux documentation](http://selinuxproject.org/page/Main_Page)
Sep 18, 2016
Sep 18, 2016
150
* **`noNewPrivileges`** (bool, OPTIONAL) setting `noNewPrivileges` to true prevents the processes in the container from gaining additional privileges.
Nov 3, 2016
Nov 3, 2016
151
[The kernel doc](https://www.kernel.org/doc/Documentation/prctl/no_new_privs.txt) has more information on how this is achieved using a prctl system call.
Mar 2, 2016
Mar 2, 2016
152
Mar 17, 2016
Mar 17, 2016
153
154
### User
Jul 1, 2015
Jul 1, 2015
155
The user for the process is a platform-specific structure that allows specific control over which user the process runs as.
Mar 17, 2016
Mar 17, 2016
156
May 4, 2016
May 4, 2016
157
#### Linux and Solaris User
Mar 17, 2016
Mar 17, 2016
158
May 4, 2016
May 4, 2016
159
For Linux and Solaris based systems the user structure has the following fields:
Jun 30, 2015
Jun 30, 2015
160
Sep 18, 2016
Sep 18, 2016
161
162
* **`uid`** (int, REQUIRED) specifies the user ID in the [container namespace][container-namespace].
* **`gid`** (int, REQUIRED) specifies the group ID in the [container namespace][container-namespace].
Sep 18, 2016
Sep 18, 2016
163
* **`additionalGids`** (array of ints, OPTIONAL) specifies additional group IDs (in the [container namespace][container-namespace]) to be added to the process.
Jun 30, 2015
Jun 30, 2015
164
Mar 17, 2016
Mar 17, 2016
165
166
_Note: symbolic name for uid and gid, such as uname and gname respectively, are left to upper levels to derive (i.e. `/etc/passwd` parsing, NSS, etc)_
Apr 8, 2016
Apr 8, 2016
167
### Example (Linux)
Jun 30, 2015
Jun 30, 2015
168
Jun 29, 2015
Jun 29, 2015
169
```json
Jun 30, 2015
Jun 30, 2015
170
171
"process": {
"terminal": true,
Sep 20, 2016
Sep 20, 2016
172
173
174
175
"consoleSize": {
"height": 25,
"width": 80
},
Jun 30, 2015
Jun 30, 2015
176
177
178
"user": {
"uid": 1,
"gid": 1,
Aug 29, 2015
Aug 29, 2015
179
"additionalGids": [5, 6]
Jun 30, 2015
Jun 30, 2015
180
},
Jun 30, 2015
Jun 30, 2015
181
182
183
184
"env": [
"PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin",
"TERM=xterm"
],
Aug 29, 2015
Aug 29, 2015
185
"cwd": "/root",
Jun 30, 2015
Jun 30, 2015
186
187
"args": [
"sh"
Mar 2, 2016
Mar 2, 2016
188
],
Mar 2, 2016
Mar 2, 2016
189
190
"apparmorProfile": "acme_secure_profile",
"selinuxLabel": "system_u:system_r:svirt_lxc_net_t:s0:c124,c675",
Mar 2, 2016
Mar 2, 2016
191
192
193
194
195
"noNewPrivileges": true,
"capabilities": [
"CAP_AUDIT_WRITE",
"CAP_KILL",
"CAP_NET_BIND_SERVICE"
Mar 10, 2016
Mar 10, 2016
196
197
198
199
200
201
202
],
"rlimits": [
{
"type": "RLIMIT_NOFILE",
"hard": 1024,
"soft": 1024
}
Jun 30, 2015
Jun 30, 2015
203
204
]
}
Jun 25, 2015
Jun 25, 2015
205
```
May 4, 2016
May 4, 2016
206
207
208
209
210
### Example (Solaris)
```json
"process": {
"terminal": true,
Sep 20, 2016
Sep 20, 2016
211
212
213
214
"consoleSize": {
"height": 25,
"width": 80
},
May 4, 2016
May 4, 2016
215
216
217
218
219
220
221
222
223
224
225
226
"user": {
"uid": 1,
"gid": 1,
"additionalGids": [2, 8]
},
"env": [
"PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin",
"TERM=xterm"
],
"cwd": "/root",
"args": [
"/usr/bin/bash"
Sep 14, 2016
Sep 14, 2016
227
228
229
230
231
232
233
234
]
}
```
#### Windows User
For Windows based systems the user structure has the following fields:
Sep 18, 2016
Sep 18, 2016
235
* **`username`** (string, OPTIONAL) specifies the user name for the process.
Sep 14, 2016
Sep 14, 2016
236
237
238
239
240
241
242
243
244
245
246
### Example (Windows)
```json
"process": {
"terminal": true,
"user": {
"username": "containeradministrator"
},
"env": [
"VARIABLE=1"
May 4, 2016
May 4, 2016
247
],
Sep 14, 2016
Sep 14, 2016
248
249
250
251
"cwd": "c:\\foo",
"args": [
"someapp.exe",
]
May 4, 2016
May 4, 2016
252
253
}
```
Jun 25, 2015
Jun 25, 2015
254
255
Jun 30, 2015
Jun 30, 2015
256
## Hostname
Jun 25, 2015
Jun 25, 2015
257
Sep 18, 2016
Sep 18, 2016
258
* **`hostname`** (string, OPTIONAL) configures the container's hostname as seen by processes running inside the container.
Jan 11, 2017
Jan 11, 2017
259
260
On Linux, this will change the hostname in the [container][container-namespace] [UTS namespace][uts-namespace].
Depending on your [namespace configuration](config-linux.md#namespaces), the container UTS namespace may be the [runtime UTS namespace][runtime-namespace].
Jun 25, 2015
Jun 25, 2015
261
Apr 8, 2016
Apr 8, 2016
262
### Example
Jun 30, 2015
Jun 30, 2015
263
Jun 29, 2015
Jun 29, 2015
264
```json
Jun 30, 2015
Jun 30, 2015
265
"hostname": "mrsdalloway"
Jun 25, 2015
Jun 25, 2015
266
267
```
May 2, 2016
May 2, 2016
268
## Platform
Jun 25, 2015
Jun 25, 2015
269
Aug 3, 2016
Aug 3, 2016
270
271
**`platform`** specifies the configuration's target platform.
Sep 18, 2016
Sep 18, 2016
272
* **`os`** (string, REQUIRED) specifies the operating system family this image targets.
May 20, 2016
May 20, 2016
273
274
275
The runtime MUST generate an error if it does not support the configured **`os`**.
Bundles SHOULD use, and runtimes SHOULD understand, **`os`** entries listed in the Go Language document for [`$GOOS`][go-environment].
If an operating system is not included in the `$GOOS` documentation, it SHOULD be submitted to this specification for standardization.
Sep 18, 2016
Sep 18, 2016
276
* **`arch`** (string, REQUIRED) specifies the instruction set for which the binaries in the image have been compiled.
May 20, 2016
May 20, 2016
277
278
279
The runtime MUST generate an error if it does not support the configured **`arch`**.
Values for **`arch`** SHOULD use, and runtimes SHOULD understand, **`arch`** entries listed in the Go Language document for [`$GOARCH`][go-environment].
If an architecture is not included in the `$GOARCH` documentation, it SHOULD be submitted to this specification for standardization.
Jun 30, 2015
Jun 30, 2015
280
Apr 8, 2016
Apr 8, 2016
281
282
### Example
Jun 29, 2015
Jun 29, 2015
283
```json
Jun 30, 2015
Jun 30, 2015
284
285
286
287
"platform": {
"os": "linux",
"arch": "amd64"
}
Jun 25, 2015
Jun 25, 2015
288
289
```
May 2, 2016
May 2, 2016
290
291
292
293
## Platform-specific configuration
[**`platform.os`**](#platform) is used to lookup further platform-specific configuration.
Sep 18, 2016
Sep 18, 2016
294
* **`linux`** (object, OPTIONAL) [Linux-specific configuration](config-linux.md).
May 23, 2016
May 23, 2016
295
This SHOULD only be set if **`platform.os`** is `linux`.
Sep 18, 2016
Sep 18, 2016
296
* **`solaris`** (object, OPTIONAL) [Solaris-specific configuration](config-solaris.md).
May 23, 2016
May 23, 2016
297
This SHOULD only be set if **`platform.os`** is `solaris`.
Nov 14, 2016
Nov 14, 2016
298
* **`windows`** (object, OPTIONAL) [Windows-specific configuration](config-windows.md).
Sep 22, 2016
Sep 22, 2016
299
This SHOULD only be set if **`platform.os`** is `windows`.
May 2, 2016
May 2, 2016
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
### Example (Linux)
```json
{
"platform": {
"os": "linux",
"arch": "amd64"
},
"linux": {
"namespaces": [
{
"type": "pid"
}
]
}
}
```
Oct 6, 2015
Oct 6, 2015
318
Jan 27, 2016
Jan 27, 2016
319
320
321
322
## Hooks
Lifecycle hooks allow custom events for different points in a container's runtime.
Jan 4, 2017
Jan 4, 2017
323
324
325
326
327
328
329
330
331
332
333
334
* **`hooks`** (object, OPTIONAL) MAY contain any of the following properties:
* **`prestart`** (array, OPTIONAL) is an array of [pre-start hooks](#prestart).
Entries in the array contain the following properties:
* **`path`** (string, REQUIRED) with similar semantics to [IEEE Std 1003.1-2001 `execv`'s *path*][ieee-1003.1-2001-xsh-exec].
This specification extends the IEEE standard in that **`path`** MUST be absolute.
* **`args`** (array of strings, REQUIRED) with the same semantics as [IEEE Std 1003.1-2001 `execv`'s *argv*][ieee-1003.1-2001-xsh-exec].
* **`env`** (array of strings, OPTIONAL) with the same semantics as [IEEE Std 1003.1-2001's `environ`][ieee-1003.1-2001-xbd-c8.1].
* **`timeout`** (int, OPTIONAL) is the number of seconds before aborting the hook.
* **`poststart`** (array, OPTIONAL) is an array of [post-start hooks](#poststart).
Entries in the array have the same schema as pre-start entries.
* **`poststop`** (array, OPTIONAL) is an array of [post-stop hooks](#poststop).
Entries in the array have the same schema as pre-start entries.
Jan 27, 2016
Jan 27, 2016
335
Nov 18, 2016
Nov 18, 2016
336
Hooks allow one to run programs before/after various lifecycle events of the container.
Jan 27, 2016
Jan 27, 2016
337
Hooks MUST be called in the listed order.
Jan 4, 2017
Jan 4, 2017
338
The [state](runtime.md#state) of the container is passed to the hooks over stdin, so the hooks could get the information they need to do their work.
Jan 27, 2016
Jan 27, 2016
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
### Prestart
The pre-start hooks are called after the container process is spawned, but before the user supplied command is executed.
They are called after the container namespaces are created on Linux, so they provide an opportunity to customize the container.
In Linux, for e.g., the network namespace could be configured in this hook.
If a hook returns a non-zero exit code, then an error including the exit code and the stderr is returned to the caller and the container is torn down.
### Poststart
The post-start hooks are called after the user process is started.
For example this hook can notify user that real process is spawned.
If a hook returns a non-zero exit code, then an error is logged and the remaining hooks are executed.
### Poststop
The post-stop hooks are called after the container process is stopped.
Cleanup or debugging could be performed in such a hook.
If a hook returns a non-zero exit code, then an error is logged and the remaining hooks are executed.
Apr 8, 2016
Apr 8, 2016
361
### Example
Jan 27, 2016
Jan 27, 2016
362
363
```json
Sep 7, 2016
Sep 7, 2016
364
"hooks": {
Jan 27, 2016
Jan 27, 2016
365
366
367
368
369
370
371
372
373
374
375
376
"prestart": [
{
"path": "/usr/bin/fix-mounts",
"args": ["fix-mounts", "arg1", "arg2"],
"env": [ "key1=value1"]
},
{
"path": "/usr/bin/setup-network"
}
],
"poststart": [
{
Apr 11, 2016
Apr 11, 2016
377
"path": "/usr/bin/notify-start",
Mar 16, 2016
Mar 16, 2016
378
"timeout": 5
Jan 27, 2016
Jan 27, 2016
379
380
381
382
383
384
385
386
387
388
389
}
],
"poststop": [
{
"path": "/usr/sbin/cleanup.sh",
"args": ["cleanup.sh", "-f"]
}
]
}
```
Mar 9, 2016
Mar 9, 2016
390
391
## Annotations
Sep 18, 2016
Sep 18, 2016
392
**`annotations`** (object, OPTIONAL) contains arbitrary metadata for the container.
May 23, 2016
May 23, 2016
393
This information MAY be structured or unstructured.
Sep 2, 2016
Sep 2, 2016
394
395
Annotations MUST be a key-value map where both the key and value MUST be strings.
While the value MUST be present, it MAY be an empty string.
Dec 28, 2016
Dec 28, 2016
396
Keys MUST be unique and MUST NOT be an empty string within this map, and best practice is to namespace the keys.
Sep 2, 2016
Sep 2, 2016
397
398
399
400
Keys SHOULD be named using a reverse domain notation - e.g. `com.example.myKey`.
Keys using the `org.opencontainers` namespace are reserved and MUST NOT be used by subsequent specifications.
If there are no annotations then this property MAY either be absent or an empty map.
Implementations that are reading/processing this configuration file MUST NOT generate an error if they encounter an unknown annotation key.
Mar 9, 2016
Mar 9, 2016
401
402
403
```json
"annotations": {
Sep 7, 2016
Sep 7, 2016
404
"com.example.gpu-cores": "2"
Mar 9, 2016
Mar 9, 2016
405
406
407
}
```
Sep 2, 2016
Sep 2, 2016
408
## Extensibility
Sep 17, 2016
Sep 17, 2016
409
Implementations that are reading/processing this configuration file MUST NOT generate an error if they encounter an unknown property.
Sep 2, 2016
Sep 2, 2016
410
411
Instead they MUST ignore unknown properties.
Mar 9, 2016
Mar 9, 2016
412
413
414
415
416
417
## Configuration Schema Example
Here is a full example `config.json` for reference.
```json
{
Apr 11, 2016
Apr 11, 2016
418
"ociVersion": "0.5.0-dev",
Mar 9, 2016
Mar 9, 2016
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
"platform": {
"os": "linux",
"arch": "amd64"
},
"process": {
"terminal": true,
"user": {
"uid": 1,
"gid": 1,
"additionalGids": [
5,
6
]
},
"args": [
"sh"
],
"env": [
"PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin",
"TERM=xterm"
],
"cwd": "/",
"capabilities": [
"CAP_AUDIT_WRITE",
"CAP_KILL",
"CAP_NET_BIND_SERVICE"
],
Mar 10, 2016
Mar 10, 2016
446
"rlimits": [
Apr 11, 2016
Apr 11, 2016
447
448
449
450
451
{
"type": "RLIMIT_CORE",
"hard": 1024,
"soft": 1024
},
Mar 10, 2016
Mar 10, 2016
452
453
454
455
456
457
{
"type": "RLIMIT_NOFILE",
"hard": 1024,
"soft": 1024
}
],
Apr 11, 2016
Apr 11, 2016
458
459
460
"apparmorProfile": "acme_secure_profile",
"selinuxLabel": "system_u:system_r:svirt_lxc_net_t:s0:c124,c675",
"noNewPrivileges": true
Mar 9, 2016
Mar 9, 2016
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
},
"root": {
"path": "rootfs",
"readonly": true
},
"hostname": "slartibartfast",
"mounts": [
{
"destination": "/proc",
"type": "proc",
"source": "proc"
},
{
"destination": "/dev",
"type": "tmpfs",
"source": "tmpfs",
"options": [
"nosuid",
"strictatime",
"mode=755",
"size=65536k"
]
},
{
"destination": "/dev/pts",
"type": "devpts",
"source": "devpts",
"options": [
"nosuid",
"noexec",
"newinstance",
"ptmxmode=0666",
"mode=0620",
"gid=5"
]
},
{
"destination": "/dev/shm",
"type": "tmpfs",
"source": "shm",
"options": [
"nosuid",
"noexec",
"nodev",
"mode=1777",
"size=65536k"
]
},
{
"destination": "/dev/mqueue",
"type": "mqueue",
"source": "mqueue",
"options": [
"nosuid",
"noexec",
"nodev"
]
},
{
"destination": "/sys",
"type": "sysfs",
"source": "sysfs",
"options": [
"nosuid",
"noexec",
"nodev"
]
},
{
"destination": "/sys/fs/cgroup",
"type": "cgroup",
"source": "cgroup",
"options": [
"nosuid",
"noexec",
"nodev",
"relatime",
"ro"
]
}
],
"hooks": {
"prestart": [
{
Apr 11, 2016
Apr 11, 2016
545
"path": "/usr/bin/fix-mounts",
Mar 9, 2016
Mar 9, 2016
546
"args": [
Apr 11, 2016
Apr 11, 2016
547
548
549
"fix-mounts",
"arg1",
"arg2"
Mar 9, 2016
Mar 9, 2016
550
],
Apr 11, 2016
Apr 11, 2016
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
"env": [
"key1=value1"
]
},
{
"path": "/usr/bin/setup-network"
}
],
"poststart": [
{
"path": "/usr/bin/notify-start",
"timeout": 5
}
],
"poststop": [
{
"path": "/usr/sbin/cleanup.sh",
"args": [
"cleanup.sh",
"-f"
]
Mar 9, 2016
Mar 9, 2016
572
573
574
575
}
]
},
"linux": {
Apr 11, 2016
Apr 11, 2016
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
"devices": [
{
"path": "/dev/fuse",
"type": "c",
"major": 10,
"minor": 229,
"fileMode": 438,
"uid": 0,
"gid": 0
},
{
"path": "/dev/sda",
"type": "b",
"major": 8,
"minor": 0,
"fileMode": 432,
"uid": 0,
"gid": 0
}
],
Apr 20, 2016
Apr 20, 2016
596
597
598
599
600
601
602
603
604
605
606
607
608
609
"uidMappings": [
{
"hostID": 1000,
"containerID": 0,
"size": 32000
}
],
"gidMappings": [
{
"hostID": 1000,
"containerID": 0,
"size": 32000
}
],
Apr 11, 2016
Apr 11, 2016
610
611
612
613
614
"sysctl": {
"net.ipv4.ip_forward": "1",
"net.core.somaxconn": "256"
},
"cgroupsPath": "/myRuntime/myContainer",
Mar 9, 2016
Mar 9, 2016
615
"resources": {
Apr 11, 2016
Apr 11, 2016
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
"network": {
"classID": 1048577,
"priorities": [
{
"name": "eth0",
"priority": 500
},
{
"name": "eth1",
"priority": 1000
}
]
},
"pids": {
"limit": 32771
},
"hugepageLimits": [
{
"pageSize": "2MB",
"limit": 9223372036854772000
}
],
"oomScoreAdj": 100,
"memory": {
"limit": 536870912,
"reservation": 536870912,
"swap": 536870912,
"kernel": 0,
"kernelTCP": 0,
"swappiness": 0
},
"cpu": {
"shares": 1024,
"quota": 1000000,
"period": 500000,
"realtimeRuntime": 950000,
"realtimePeriod": 1000000,
"cpus": "2-3",
"mems": "0-7"
},
"disableOOMKiller": false,
Mar 9, 2016
Mar 9, 2016
657
658
659
660
"devices": [
{
"allow": false,
"access": "rwm"
Apr 11, 2016
Apr 11, 2016
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
},
{
"allow": true,
"type": "c",
"major": 10,
"minor": 229,
"access": "rw"
},
{
"allow": true,
"type": "b",
"major": 8,
"minor": 0,
"access": "r"
}
],
"blockIO": {
"blkioWeight": 10,
"blkioLeafWeight": 10,
"blkioWeightDevice": [
{
"major": 8,
"minor": 0,
"weight": 500,
"leafWeight": 300
},
{
"major": 8,
"minor": 16,
"weight": 500
}
],
"blkioThrottleReadBpsDevice": [
{
"major": 8,
"minor": 0,
"rate": 600
}
],
"blkioThrottleWriteIOPSDevice": [
{
"major": 8,
"minor": 16,
"rate": 300
}
]
}
},
"rootfsPropagation": "slave",
"seccomp": {
"defaultAction": "SCMP_ACT_ALLOW",
"architectures": [
"SCMP_ARCH_X86"
],
"syscalls": [
{
"name": "getcwd",
"action": "SCMP_ACT_ERRNO"
Mar 9, 2016
Mar 9, 2016
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
}
]
},
"namespaces": [
{
"type": "pid"
},
{
"type": "network"
},
{
"type": "ipc"
},
{
"type": "uts"
},
{
"type": "mount"
Jun 3, 2016
Jun 3, 2016
737
738
739
740
741
742
},
{
"type": "user"
},
{
"type": "cgroup"
Mar 9, 2016
Mar 9, 2016
743
}
Apr 11, 2016
Apr 11, 2016
744
745
746
747
748
749
750
751
752
753
754
755
756
757
],
"maskedPaths": [
"/proc/kcore",
"/proc/latency_stats",
"/proc/timer_stats",
"/proc/sched_debug"
],
"readonlyPaths": [
"/proc/asound",
"/proc/bus",
"/proc/fs",
"/proc/irq",
"/proc/sys",
"/proc/sysrq-trigger"
Apr 22, 2016
Apr 22, 2016
758
759
],
"mountLabel": "system_u:object_r:svirt_sandbox_file_t:s0:c715,c811"
Apr 11, 2016
Apr 11, 2016
760
761
},
"annotations": {
Sep 2, 2016
Sep 2, 2016
762
763
"com.example.key1": "value1",
"com.example.key2": "value2"
Mar 9, 2016
Mar 9, 2016
764
}
Mar 9, 2016
Mar 9, 2016
765
766
767
}
```
Jun 2, 2016
Jun 2, 2016
768
769
[container-namespace]: glossary.md#container-namespace
[go-environment]: https://golang.org/doc/install/source#environment
Jan 4, 2017
Jan 4, 2017
770
[ieee-1003.1-2001-xbd-c8.1]: http://pubs.opengroup.org/onlinepubs/009695399/basedefs/xbd_chap08.html#tag_08_01
Jan 4, 2017
Jan 4, 2017
771
[ieee-1003.1-2001-xsh-exec]: http://pubs.opengroup.org/onlinepubs/009695399/functions/exec.html
Apr 30, 2016
Apr 30, 2016
772
[runtime-namespace]: glossary.md#runtime-namespace
Oct 6, 2015
Oct 6, 2015
773
[uts-namespace]: http://man7.org/linux/man-pages/man7/namespaces.7.html
Sep 14, 2016
Sep 14, 2016
774
775
[mount.8-filesystem-independent]: http://man7.org/linux/man-pages/man8/mount.8.html#FILESYSTEM-INDEPENDENT_MOUNT%20OPTIONS
[mount.8-filesystem-specific]: http://man7.org/linux/man-pages/man8/mount.8.html#FILESYSTEM-SPECIFIC_MOUNT%20OPTIONS
Jul 22, 2016
Jul 22, 2016
776
[mount.8]: http://man7.org/linux/man-pages/man8/mount.8.html
Oct 19, 2016
Oct 19, 2016
777
[stdin.3]: http://man7.org/linux/man-pages/man3/stdin.3.html