Skip to content

Commit 2022e3e

Browse files
committed
config: Bump Hyper-V condition from root.path to root itself
Don't require users targetting Hyper-V to set an empty object ("root": {}). This also avoids confusion about whether you can set root.readonly without setting root.path (you can't). Move the relative, absolute, and rootfs bits into a POSIX paragraph, because they don't apply to Windows where the value MUST be a volume GUID path (since 2283e63, Windows: Remove Sandbox, additional tweaks, 2017-05-23, #849). We don't need the "for Windows Server containers" condition on volume GUID paths, because with this commit that condition is already applied at the 'root' level and the Hyper-V case has already been handled there. Signed-off-by: W. Trevor King <[email protected]>
1 parent 63b7c6c commit 2022e3e

File tree

3 files changed

+18
-12
lines changed

3 files changed

+18
-12
lines changed

config.md

Lines changed: 12 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -26,18 +26,22 @@ For all platform-specific configuration values, the scope defined below in the [
2626

2727
## <a name="configRoot" />Root
2828

29-
**`root`** (object, REQUIRED) specifies the container's root filesystem.
29+
**`root`** (object, OPTIONAL) specifies the container's root filesystem.
30+
On Windows, for Windows Server Containers, this field is REQUIRED.
31+
For [Hyper-V Containers](config-windows.md#hyperv), this field MUST NOT be set.
3032

31-
* **`path`** (string, OPTIONAL) Specifies the path to the root filesystem for the container.
32-
The path is either an absolute path or a relative path to the bundle.
33+
On all other platforms, this field is REQUIRED.
3334

34-
* On Windows, for Windows Server Containers, this field is REQUIRED and MUST be specified as a [volume GUID path][naming-a-volume].
35-
For Hyper-V Containers, this field MUST be omitted.
36-
* On all other platforms, this field is REQUIRED.
35+
* **`path`** (string, REQUIRED) Specifies the path to the root filesystem for the container.
36+
37+
* On Windows, `path` MUST be a [volume GUID path][naming-a-volume].
38+
39+
* On Linux and Solaris, `path` is either an absolute path or a relative path to the bundle.
40+
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`.
3741
The value SHOULD be the conventional `rootfs`.
38-
* 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`.
3942

40-
If defined, a directory MUST exist at the path declared by the field.
43+
A directory MUST exist at the path declared by the field.
44+
4145
* **`readonly`** (bool, OPTIONAL) If true then the root filesystem MUST be read-only inside the container, defaults to false.
4246
* On Windows, this field MUST be omitted or false.
4347

schema/config-schema.json

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,9 @@
4141
"description": "Configures the container's root filesystem.",
4242
"id": "https://opencontainers.org/schema/bundle/root",
4343
"type": "object",
44+
"required": [
45+
"path"
46+
],
4447
"properties": {
4548
"path": {
4649
"id": "https://opencontainers.org/schema/bundle/root/path",
@@ -214,7 +217,6 @@
214217
}
215218
},
216219
"required": [
217-
"ociVersion",
218-
"root"
220+
"ociVersion"
219221
]
220222
}

specs-go/config.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ type Spec struct {
99
// Process configures the container process.
1010
Process *Process `json:"process,omitempty"`
1111
// Root configures the container's root filesystem.
12-
Root Root `json:"root"`
12+
Root *Root `json:"root,omitempty"`
1313
// Hostname configures the container's hostname.
1414
Hostname string `json:"hostname,omitempty"`
1515
// Mounts configures additional mounts (on top of Root).
@@ -94,7 +94,7 @@ type User struct {
9494
// Root contains information about the container's root filesystem on the host.
9595
type Root struct {
9696
// Path is the absolute path to the container's root filesystem.
97-
Path string `json:"path,omitempty"`
97+
Path string `json:"path"`
9898
// Readonly makes the root filesystem for the container readonly before the process is executed.
9999
Readonly bool `json:"readonly,omitempty"`
100100
}

0 commit comments

Comments
 (0)