Skip to content

Commit 28a4a9d

Browse files
committed
manifest: Explicitly make 'layers' optional
Most folks will distribute images containing layers, but the specified behavior applies cleanly to the layer-less case too. The unpacked rootfs will just be an empty directory with unspecified attributes. Folks might want to use that sort of thing for namespace pinning [1], distributing configs [2], setting up containers that mount the meat from the host [2], etc. [1]: opencontainers/runtime-spec#395 (comment) [2]: #313 (comment) Signed-off-by: W. Trevor King <[email protected]>
1 parent 5d4d777 commit 28a4a9d

File tree

3 files changed

+4
-5
lines changed

3 files changed

+4
-5
lines changed

manifest.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -157,9 +157,9 @@ Unlike the [Manifest List](#manifest-list), which contains information about a s
157157

158158
- **`layers`** *array*
159159

160+
This OPTIONAL property references the [layers](layer.md) defining the container's root filesystem.
160161
Each item in the array MUST be a [descriptor](descriptor.md).
161-
The array MUST have the base image at index 0.
162-
Subsequent layers MUST then follow in stack order (i.e. from `layers[0]` to `layers[len(layers)]`).
162+
Layers MUST must be [applied](layer.md#applying) in stack order (i.e. from `layers[0]` to `layers[len(layers)]`).
163163
The final filesystem layout MUST match the result of [applying](layer.md#applying) the layers to an empty directory.
164164
The [ownership, mode, and other attributes](layer.md#file-attributes) of the initial empty directory are unspecified.
165165

schema/image-manifest-schema.json

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,6 @@
3030
"required": [
3131
"schemaVersion",
3232
"mediaType",
33-
"config",
34-
"layers"
33+
"config"
3534
]
3635
}

specs-go/v1/manifest.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ type Manifest struct {
2525
Config Descriptor `json:"config"`
2626

2727
// Layers is an indexed list of layers referenced by the manifest.
28-
Layers []Descriptor `json:"layers"`
28+
Layers []Descriptor `json:"layers,omitempty"`
2929

3030
// Annotations contains arbitrary metadata for the manifest list.
3131
Annotations map[string]string `json:"annotations"`

0 commit comments

Comments
 (0)