You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: config.md
+61-59Lines changed: 61 additions & 59 deletions
Original file line number
Diff line number
Diff line change
@@ -2,11 +2,15 @@
2
2
3
3
The container's top-level directory MUST contain a configuration file called `config.json`.
4
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).
5
+
Platform-specific configuration schema are defined in the [platform-specific documents](#platform-specific-configuration) linked below.
5
6
6
7
The configuration file contains metadata necessary to implement standard operations against the container.
7
8
This includes the process to run, environment variables to inject, sandboxing features to use, etc.
8
9
9
-
Below is a detailed description of each field defined in the configuration format.
10
+
Below is a detailed description of each field defined in the configuration format and valid values are specified.
11
+
Platform-specific fields are identified as such.
12
+
For all platform-specific configuration values, the scope defined below in the [Platform-specific configuration](#platform-specific-configuration) section applies.
13
+
10
14
11
15
## Specification version
12
16
@@ -22,11 +26,11 @@ For example, if a configuration is compliant with version 1.1 of this specificat
22
26
23
27
## Root Configuration
24
28
25
-
**`root`** (object, REQUIRED) configures the container's root filesystem.
29
+
**`root`** (object, REQUIRED) specifies the container's root filesystem.
26
30
27
31
***`path`** (string, REQUIRED) Specifies the path to the root filesystem for the container.
28
-
The path can be an absolute path (starting with /) or a relative path (not starting with /), which is relative to the bundle.
29
-
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`.
32
+
The path is either an absolute path or a relative path to the bundle.
33
+
On Linux, for example, 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`.
30
34
A directory MUST exist at the path declared by the field.
31
35
***`readonly`** (bool, OPTIONAL) If true then the root filesystem MUST be read-only inside the container, defaults to false.
32
36
@@ -41,25 +45,27 @@ For example, if a configuration is compliant with version 1.1 of this specificat
41
45
42
46
## Mounts
43
47
44
-
**`mounts`** (array, OPTIONAL) configures additional mounts (on top of [`root`](#root-configuration)).
The runtime MUST mount entries in the listed order.
46
-
The parameters are similar to the ones in [the Linux mount system call](http://man7.org/linux/man-pages/man2/mount.2.html).
47
-
For Solaris, the mounts corresponds to fs resource in zonecfg(8).
50
+
For Linux, the parameters are as documented in [the mount system call](http://man7.org/linux/man-pages/man2/mount.2.html).
51
+
For Solaris, the mount entry corresponds to the 'fs' resource in zonecfg(8).
52
+
For Windows, 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).
53
+
48
54
49
55
***`destination`** (string, REQUIRED) Destination of mount point: path inside container.
50
56
This value MUST be an absolute path.
51
-
For the Windows operating system, one mount destination MUST NOT be nested within another mount (e.g., c:\\foo and c:\\foo\\bar).
52
-
For the Solaris operating system, this corresponds to "dir" of the fs resource in zonecfg(8).
57
+
*Windows: one mount destination MUST NOT be nested within another mount (e.g., c:\\foo and c:\\foo\\bar).
58
+
*Solaris: corresponds to "dir" of the fs resource in zonecfg(8).
53
59
***`type`** (string, REQUIRED) The filesystem type of the filesystem to be mounted.
54
-
Linux: *filesystemtype*argument supported by the kernel are listed in */proc/filesystems* (e.g., "minix", "ext2", "ext3", "jfs", "xfs", "reiserfs", "msdos", "proc", "nfs", "iso9660").
55
-
Windows: ntfs.
56
-
Solaris: corresponds to "type" of the fs resource in zonecfg(8).
60
+
*Linux: valid *filesystemtype* supported by the kernel as listed in */proc/filesystems* (e.g., "minix", "ext2", "ext3", "jfs", "xfs", "reiserfs", "msdos", "proc", "nfs", "iso9660").
61
+
*Windows: the type of file system on the volume, e.g. "ntfs".
62
+
*Solaris: corresponds to "type" of the fs resource in zonecfg(8).
57
63
***`source`** (string, REQUIRED) A device name, but can also be a directory name or a dummy.
58
-
Windows: the volume name that is the target of the mount point, \\?\Volume\{GUID}\ (on Windows source is called target).
59
-
Solaris: corresponds to "special" of the fs resource in zonecfg(8).
64
+
*Windows: the volume name that is the target of the mount point, \\?\Volume\{GUID}\ (on Windows source is called target).
65
+
*Solaris: corresponds to "special" of the fs resource in zonecfg(8).
60
66
***`options`** (list of strings, OPTIONAL) Mount options of the filesystem to be used.
61
-
Linux: [supported][mount.8-filesystem-independent][options][mount.8-filesystem-specific] are listed in [mount(8)][mount.8].
62
-
Solaris: corresponds to "options" of the fs resource in zonecfg(8).
67
+
*Linux: [supported][mount.8-filesystem-independent][options][mount.8-filesystem-specific] are listed in [mount(8)][mount.8].
68
+
*Solaris: corresponds to "options" of the fs resource in zonecfg(8).
63
69
64
70
### Example (Linux)
65
71
@@ -93,8 +99,6 @@ For Solaris, the mounts corresponds to fs resource in zonecfg(8).
93
99
]
94
100
```
95
101
96
-
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.
97
-
98
102
### Example (Solaris)
99
103
100
104
```json
@@ -113,13 +117,12 @@ See links for details about [mountvol](http://ss64.com/nt/mountvol.html) and [Se
113
117
]
114
118
```
115
119
116
-
117
120
## Process
118
121
119
-
**`process`** (object, REQUIRED) configures the container process.
122
+
**`process`** (object, REQUIRED) specifies the container process.
120
123
121
124
***`terminal`** (bool, OPTIONAL) specifies whether a terminal is attached to that process, defaults to false.
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].
125
+
As an example, if set to true 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].
123
126
***`consoleSize`** (object, OPTIONAL) specifies the console size of the terminal if attached, containing the following properties:
124
127
***`height`** (uint, REQUIRED)
125
128
***`width`** (uint, REQUIRED)
@@ -128,27 +131,25 @@ See links for details about [mountvol](http://ss64.com/nt/mountvol.html) and [Se
128
131
***`env`** (array of strings, OPTIONAL) with the same semantics as [IEEE Std 1003.1-2001's `environ`][ieee-1003.1-2001-xbd-c8.1].
129
132
***`args`** (array of strings, REQUIRED) with similar semantics to [IEEE Std 1003.1-2001 `execvp`'s *argv*][ieee-1003.1-2001-xsh-exec].
130
133
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*.
131
-
132
-
For Linux-based systems the process structure supports the following process specific fields:
133
-
134
-
***`capabilities`** (array of strings, OPTIONAL) capabilities is an array that specifies Linux capabilities that can be provided to the process inside the container.
135
-
Valid values are the strings for capabilities defined in [the man page](http://man7.org/linux/man-pages/man7/capabilities.7.html).
134
+
***`capabilities`** (array of strings, OPTIONAL) is an array that specifies the set of capabilities of the process(es) inside the container. Valid values are platform-specific. For example, valid values for Linux are defined in the [CAPABILITIES(7)](http://man7.org/linux/man-pages/man7/capabilities.7.html) man page.
136
135
***`rlimits`** (array of objects, OPTIONAL) allows setting resource limits for a process inside the container.
137
136
Each entry has the following structure:
138
137
139
-
***`type`** (string, REQUIRED) - the 'type' field are the resources defined in [the man page](http://man7.org/linux/man-pages/man2/setrlimit.2.html).
140
-
***`soft`** (uint64, REQUIRED) - the value that the kernel enforces for the corresponding resource.
141
-
***`hard`** (uint64, REQUIRED) - the ceiling for the soft limit that could be set by an unprivileged process.
142
-
Only privileged process (under Linux: one with the CAP_SYS_RESOURCE capability) can raise a hard limit.
138
+
***`type`** (string, REQUIRED) - the platform resource being limited, for example on Linux as defined in the [SETRLIMIT(2)](http://man7.org/linux/man-pages/man2/setrlimit.2.html) man page.
139
+
***`soft`** (uint64, REQUIRED) - the value of the limit enforced for the corresponding resource.
140
+
***`hard`** (uint64, REQUIRED) - the ceiling for the soft limit that could be set by an unprivileged process. Only a privileged process (e.g. under Linux: one with the CAP_SYS_RESOURCE capability) can raise a hard limit.
143
141
144
142
If `rlimits` contains duplicated entries with same `type`, the runtime MUST error out.
145
143
146
-
***`apparmorProfile`** (string, OPTIONAL) apparmor profile specifies the name of the apparmor profile that will be used for the container.
147
-
For more information about Apparmor, see [Apparmor documentation](https://wiki.ubuntu.com/AppArmor)
148
-
***`selinuxLabel`** (string, OPTIONAL) SELinux process label specifies the label with which the processes in a container are run.
149
-
For more information about SELinux, see [Selinux documentation](http://selinuxproject.org/page/Main_Page)
150
144
***`noNewPrivileges`** (bool, OPTIONAL) setting `noNewPrivileges` to true prevents the processes in the container from gaining additional privileges.
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.
145
+
As an example, the ['no_new_privs' 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 on Linux.
146
+
147
+
For Linux-based systems the process structure supports the following process specific fields.
148
+
149
+
***`apparmorProfile`** (string, OPTIONAL) specifies the name of the AppArmor profile to be applied to processes in the container.
150
+
For more information about AppArmor, see [AppArmor documentation](https://wiki.ubuntu.com/AppArmor)
151
+
***`selinuxLabel`** (string, OPTIONAL) specifies the SELinux label to be applied to the processes in the container.
152
+
For more information about SELinux, see [SELinux documentation](http://selinuxproject.org/page/Main_Page)
152
153
153
154
### User
154
155
@@ -255,8 +256,8 @@ For Windows based systems the user structure has the following fields:
255
256
256
257
## Hostname
257
258
258
-
***`hostname`** (string, OPTIONAL) configures the container's hostname as seen by processes running inside the container.
259
-
On Linux, this will change the hostname in the [container][container-namespace][UTS namespace][uts-namespace].
259
+
***`hostname`** (string, OPTIONAL) specifies the container's hostname as seen by processes running inside the container.
260
+
On Linux, for example, this will change the hostname in the [container][container-namespace][UTS namespace][uts-namespace].
260
261
Depending on your [namespace configuration](config-linux.md#namespaces), the container UTS namespace may be the [runtime UTS namespace][runtime-namespace].
261
262
262
263
### Example
@@ -269,12 +270,12 @@ For Windows based systems the user structure has the following fields:
269
270
270
271
**`platform`** specifies the configuration's target platform.
271
272
272
-
***`os`** (string, REQUIRED) specifies the operating system family this image targets.
273
-
The runtime MUST generate an error if it does not support the configured**`os`**.
273
+
***`os`** (string, REQUIRED) specifies the operating system family of the container configuration's specified [`root`](#root-configuration) file system bundle.
274
+
The runtime MUST generate an error if it does not support the specified**`os`**.
274
275
Bundles SHOULD use, and runtimes SHOULD understand, **`os`** entries listed in the Go Language document for [`$GOOS`][go-environment].
275
276
If an operating system is not included in the `$GOOS` documentation, it SHOULD be submitted to this specification for standardization.
276
-
***`arch`** (string, REQUIRED) specifies the instruction set for which the binaries in the image have been compiled.
277
-
The runtime MUST generate an error if it does not support the configured**`arch`**.
277
+
***`arch`** (string, REQUIRED) specifies the instruction set for which the binaries in the specified [`root`](#root-configuration) file system bundle have been compiled.
278
+
The runtime MUST generate an error if it does not support the specified**`arch`**.
278
279
Values for **`arch`** SHOULD use, and runtimes SHOULD understand, **`arch`** entries listed in the Go Language document for [`$GOARCH`][go-environment].
279
280
If an architecture is not included in the `$GOARCH` documentation, it SHOULD be submitted to this specification for standardization.
280
281
@@ -289,14 +290,16 @@ For Windows based systems the user structure has the following fields:
289
290
290
291
## Platform-specific configuration
291
292
292
-
[**`platform.os`**](#platform) is used to lookup further platform-specific configuration.
293
+
[**`platform.os`**](#platform) is used to specify platform-specific configuration.
294
+
Runtime implementations MAY support any valid values for platform-specific fields as part of this configuration.
295
+
Implementations MUST error out when invalid values are encountered and MUST generate an error message and error out when encountering valid values it chooses to not support.
This MAY be set if **`platform.os`** is `solaris` and MUST NOT be set otherwise.
300
303
301
304
### Example (Linux)
302
305
@@ -318,7 +321,7 @@ For Windows based systems the user structure has the following fields:
318
321
319
322
## Hooks
320
323
321
-
Lifecycle hooks allow custom events for different points in a container's runtime.
324
+
Hooks allow for the configuration of custom actions related to the [lifecycle](runtime.md#lifecycle) of the container.
322
325
323
326
***`hooks`** (object, OPTIONAL) MAY contain any of the following properties:
324
327
***`prestart`** (array, OPTIONAL) is an array of [pre-start hooks](#prestart).
@@ -333,30 +336,29 @@ Lifecycle hooks allow custom events for different points in a container's runtim
333
336
***`poststop`** (array, OPTIONAL) is an array of [post-stop hooks](#poststop).
334
337
Entries in the array have the same schema as pre-start entries.
335
338
336
-
Hooks allow one to run programs before/after various lifecycle events of the container.
339
+
Hooks allow users to specify programs to run before or after various lifecycle events.
337
340
Hooks MUST be called in the listed order.
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.
341
+
The [state](runtime.md#state) of the container MUST be passed to hooks over stdin so that they may do work appropriate to the current state of the container.
339
342
340
343
### Prestart
341
344
342
-
The pre-start hooks are called after the container process is spawned, but before the user supplied command is executed.
343
-
They are called after the container namespaces are created on Linux, so they provide an opportunity to customize the container.
344
-
In Linux, for e.g., the network namespace could be configured in this hook.
345
+
The pre-start hooks MUST be called after the container has been created, but before the user supplied command is executed.
346
+
On Linux, for example, they are called after the container namespaces are created, so they provide an opportunity to customize the container (e.g. the network namespace could be specified in this hook).
345
347
346
-
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.
348
+
If a hook returns a non-zero exit code, an error including the exit code and the stderr MUST be returned to the caller and the container MUST be destroyed.
347
349
348
350
### Poststart
349
351
350
-
The post-start hooks are called after the user process is started.
351
-
For example this hook can notify user that real process is spawned.
352
+
The post-start hooks MUST be called after the user process is started.
353
+
For example, this hook can notify the user that the container process is spawned.
352
354
353
-
If a hook returns a non-zero exit code, then an error is logged and the remaining hooks are executed.
355
+
If a hook returns a non-zero exit code, then an error MUST be logged and the remaining hooks are executed.
354
356
355
357
### Poststop
356
358
357
-
The post-stop hooks are called after the container process is stopped.
358
-
Cleanup or debugging could be performed in such a hook.
359
-
If a hook returns a non-zero exit code, then an error is logged and the remaining hooks are executed.
359
+
The post-stop hooks MUST be called after the container process is stopped.
360
+
Cleanup or debugging functions are examples of such a hook.
361
+
If a hook returns a non-zero exit code, then an error MUST be logged and the remaining hooks are executed.
0 commit comments