Skip to content

Commit

Permalink
config: Bump Hyper-V condition from root.path to root itself
Browse files Browse the repository at this point in the history
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 <wking@tremily.us>
  • Loading branch information
wking committed Jun 1, 2017
1 parent f79b61d commit c80f4a2
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 13 deletions.
22 changes: 13 additions & 9 deletions config.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,18 +26,22 @@ For all platform-specific configuration values, the scope defined below in the [

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

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

* **`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.
Users SHOULD consider using a conventional name, such as `rootfs`.
On all other platforms, this field is REQUIRED.

* On Windows, for Windows Server Containers, this field is REQUIRED and MUST be specified as a [volume GUID path][naming-a-volume].
For Hyper-V Containers, this field MUST be omitted.
* On all other platforms, this field is REQUIRED.
* 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`.
* **`path`** (string, REQUIRED) Specifies the path to the root filesystem for the container.

* On Windows, `path` MUST be a [volume GUID path][naming-a-volume].

* On Linux and Solaris, `path` is either an absolute path or a relative path to the bundle.
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`.
Users SHOULD consider using a conventional name, such as `rootfs`.

A directory MUST exist at the path declared by the field.

If defined, 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.

Expand Down
6 changes: 4 additions & 2 deletions schema/config-schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down Expand Up @@ -233,7 +236,6 @@
},
"required": [
"ociVersion",
"platform",
"root"
"platform"
]
}
4 changes: 2 additions & 2 deletions specs-go/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -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).
Expand Down Expand Up @@ -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"`
}
Expand Down

0 comments on commit c80f4a2

Please sign in to comment.