Skip to content

Commit a396f3c

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, opencontainers#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 <wking@tremily.us>
1 parent ccfcf0b commit a396f3c

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
@@ -59,6 +59,9 @@
5959
"description": "Configures the container's root filesystem.",
6060
"id": "https://opencontainers.org/schema/bundle/root",
6161
"type": "object",
62+
"required": [
63+
"path"
64+
],
6265
"properties": {
6366
"path": {
6467
"id": "https://opencontainers.org/schema/bundle/root/path",
@@ -233,7 +236,6 @@
233236
},
234237
"required": [
235238
"ociVersion",
236-
"platform",
237-
"root"
239+
"platform"
238240
]
239241
}

specs-go/config.go

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

0 commit comments

Comments
 (0)