From c652c06bfe56bb2cedfa823c8547b2625bb7b2c9 Mon Sep 17 00:00:00 2001 From: "W. Trevor King" Date: Thu, 18 May 2017 11:25:31 -0700 Subject: [PATCH] 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 --- config.md | 10 +++++----- schema/config-schema.json | 6 ++++-- specs-go/config.go | 4 ++-- 3 files changed, 11 insertions(+), 9 deletions(-) diff --git a/config.md b/config.md index 731dfb157..fd8011f84 100644 --- a/config.md +++ b/config.md @@ -26,17 +26,17 @@ For example, if a configuration is compliant with version 1.1 of this specificat ## Root -**`root`** (object, REQUIRED) specifies the container's root filesystem. - -* **`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. - +**`root`** (object, OPTIONAL) specifies the container's root filesystem. On Windows, for Windows Server Containers, this field is REQUIRED. For Hyper-V Containers, this field MUST be omitted. On all other platforms, this field is REQUIRED. +* **`path`** (string, REQUIRED) Specifies the path to the root filesystem for the container. + The path is either an absolute path or a relative path to the bundle. 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`. - If defined, a directory MUST exist at the path declared by the field. + A directory MUST exist at the path declared by the field. + * **`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. ### Example diff --git a/schema/config-schema.json b/schema/config-schema.json index e37918b71..52f9c1908 100644 --- a/schema/config-schema.json +++ b/schema/config-schema.json @@ -59,6 +59,9 @@ "description": "Configures the container's root filesystem.", "id": "https://opencontainers.org/schema/bundle/root", "type": "object", + "required": [ + "path" + ], "properties": { "path": { "id": "https://opencontainers.org/schema/bundle/root/path", @@ -233,7 +236,6 @@ }, "required": [ "ociVersion", - "platform", - "root" + "platform" ] } diff --git a/specs-go/config.go b/specs-go/config.go index 716821523..81db537f0 100644 --- a/specs-go/config.go +++ b/specs-go/config.go @@ -11,7 +11,7 @@ type Spec struct { // Process configures the container process. Process *Process `json:"process,omitempty"` // Root configures the container's root filesystem. - Root Root `json:"root"` + Root *Root `json:"root,omitempty"` // Hostname configures the container's hostname. Hostname string `json:"hostname,omitempty"` // Mounts configures additional mounts (on top of Root). @@ -96,7 +96,7 @@ type User struct { // Root contains information about the container's root filesystem on the host. type Root struct { // Path is the absolute path to the container's root filesystem. - Path string `json:"path,omitempty"` + Path string `json:"path"` // Readonly makes the root filesystem for the container readonly before the process is executed. Readonly bool `json:"readonly,omitempty"` }