Skip to content

Commit de31fae

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). Signed-off-by: W. Trevor King <[email protected]>
1 parent 2e588b3 commit de31fae

File tree

3 files changed

+16
-11
lines changed

3 files changed

+16
-11
lines changed

config.md

Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -26,18 +26,21 @@ For example, if a configuration is compliant with version 1.1 of this specificat
2626

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

29-
**`root`** (object, REQUIRED) specifies the container's root filesystem.
30-
31-
* **`path`** (string, OPTIONAL) Specifies the path to the root filesystem for the container. The path is either an absolute path or a relative path to the bundle.
32-
Users SHOULD consider using a conventional name, such as `rootfs`.
33-
34-
On Windows, for Windows Server Containers, this field is REQUIRED. For Hyper-V Containers, this field MUST be omitted.
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.
3532

3633
On all other platforms, this field is REQUIRED.
3734

35+
* **`path`** (string, REQUIRED) Specifies the path to the root filesystem for the container.
36+
37+
The path is either an absolute path or a relative path to the bundle.
3838
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`.
3939

40-
If defined, a directory MUST exist at the path declared by the field.
40+
Users SHOULD consider using a conventional name, such as `rootfs`.
41+
42+
A directory MUST exist at the path declared by the field.
43+
4144
* **`readonly`** (bool, OPTIONAL) If true then the root filesystem MUST be read-only inside the container, defaults to false. On Windows, this field must be omitted or false.
4245

4346
### Example

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)