Skip to content

Commit 84072d8

Browse files
authored
Merge pull request #388 from wking/uncompressed-layer-media-types
media-types: Define layer media types with and without '+gzip'
2 parents 3751369 + 35b9fae commit 84072d8

File tree

7 files changed

+37
-15
lines changed

7 files changed

+37
-15
lines changed

config.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ Changing it means creating a new derived image, instead of changing the existing
2828
A layer DiffID is a SHA256 digest over the layer's uncompressed tar archive and serialized in the descriptor digest format, e.g., `sha256:a9561eb1b190625c9adb5a9513e72c4dedafc1cb2d4c5236c9a6957ec7dfd5a9`.
2929
Layers must be packed and unpacked reproducibly to avoid changing the layer DiffID, for example by using tar-split to save the tar headers.
3030

31-
NOTE: Do not confuse DiffIDs with [layer digests](manifest.md#image-manifest-property-descriptions), often referenced in the manifest, which are digests over compressed content.
31+
NOTE: Do not confuse DiffIDs with [layer digests](manifest.md#image-manifest-property-descriptions), often referenced in the manifest, which are digests over compressed or uncompressed content.
3232

3333
### Layer ChainID
3434

img/media-types.dot

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ digraph G {
33
manifestList [shape=note, label="Manifest list\n<<optional>>\napplication/vnd.oci.image.manifest.list.v1+json"]
44
manifest [shape=note, label="Image manifest\napplication/vnd.oci.image.manifest.v1+json"]
55
config [shape=note, label="Image JSON\napplication/vnd.oci.image.config.v1+json"]
6-
layer [shape=note, label="Layer tar+gzip\napplication/vnd.oci.image.layer.v1.tar+gzip\napplication/vnd.oci.image.layer.nondistributable.v1.tar+gzip"]
6+
layer [shape=note, label="Layer tar archive\napplication/vnd.oci.image.layer.v1.tar\napplication/vnd.oci.image.layer.v1.tar+gzip\napplication/vnd.oci.image.layer.nondistributable.v1.tar\napplication/vnd.oci.image.layer.nondistributable.v1.tar+gzip"]
77
}
88

99
manifestList -> manifest [label="1..*"]

img/media-types.png

7.5 KB
Loading

layer.md

Lines changed: 11 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -4,12 +4,17 @@ This document describes how to serialize a filesystem and filesystem changes lik
44
One or more layers are applied on top of each other to create a complete filesystem.
55
This document will use a concrete example to illustrate how to create and consume these filesystem layers.
66

7-
This section defines the `application/vnd.oci.image.layer.v1.tar+gzip` and `application/vnd.oci.image.layer.nondistributable.v1.tar+gzip` [media types](media-types.md).
7+
This section defines the `application/vnd.oci.image.layer.v1.tar`, `application/vnd.oci.image.layer.v1.tar+gzip`, `application/vnd.oci.image.layer.nondistributable.v1.tar`, and `application/vnd.oci.image.layer.nondistributable.v1.tar+gzip` [media types](media-types.md).
8+
9+
## `+gzip` Media Types
10+
11+
The media type `application/vnd.oci.image.layer.v1.tar+gzip` represents an `application/vnd.oci.image.layer.v1.tar` payload which has been compressed with [gzip][rfc1952].
12+
The media type `application/vnd.oci.image.layer.nondistributable.v1.tar+gzip` represents an `application/vnd.oci.image.layer.nondistributable.v1.tar` payload which has been compressed with [gzip][rfc1952].
813

914
## Distributable Format
1015

11-
Layer Changesets for the [mediatype](./media-types.md) `application/vnd.oci.image.layer.v1.tar+gzip` MUST be packaged in a [tar archive][tar-archive] compressed with [gzip][gzip].
12-
Layer Changesets for the [mediatype](./media-types.md) `application/vnd.oci.image.layer.v1.tar+gzip` MUST NOT include duplicate entries for file paths in the resulting [tar archive][tar-archive].
16+
Layer Changesets for the [media type](media-types.md) `application/vnd.oci.image.layer.v1.tar` MUST be packaged in [tar archive][tar-archive].
17+
Layer Changesets for the [media type](media-types.md) `application/vnd.oci.image.layer.v1.tar` MUST NOT include duplicate entries for file paths in the resulting [tar archive][tar-archive].
1318

1419
## Change Types
1520

@@ -208,7 +213,7 @@ To signify that the resource `./etc/my-app-config` MUST be removed when the chan
208213

209214
## Applying Changesets
210215

211-
Layer Changesets of [mediatype](./media-types.md) `application/vnd.oci.image.layer.v1.tar+gzip` are _applied_, rather than simply extracted as tar archives.
216+
Layer Changesets of [media type](media-types.md) `application/vnd.oci.image.layer.v1.tar` are _applied_, rather than simply extracted as tar archives.
212217

213218
Applying a layer changeset requires special consideration for the [whiteout](#whiteouts) files.
214219

@@ -311,12 +316,12 @@ Any given image is likely to be composed of several of these Image Filesystem Ch
311316
Due to legal requirements, certain layers may not be regularly distributable.
312317
Such "non-distributable" layers are typically downloaded directly from a distributor but never uploaded.
313318

314-
Non-distributable layers SHOULD be tagged with an alternative mediatype of `application/vnd.oci.image.layer.nondistributable.v1.tar+gzip`.
319+
Non-distributable layers SHOULD be tagged with an alternative mediatype of `application/vnd.oci.image.layer.nondistributable.v1.tar`.
315320
Implementations SHOULD NOT upload layers tagged with this media type; however, such a media type SHOULD NOT affect whether an implementation downloads the layer.
316321

317322
[Descriptors](descriptor.md) referencing non-distributable layers MAY include `urls` for downloading these layers directly; however, the presence of the `urls` field SHOULD NOT be used to determine whether or not a layer is non-distributable.
318323

319324
[libarchive-tar]: https://github.com/libarchive/libarchive/wiki/ManPageTar5#POSIX_ustar_Archives
320325
[gnu-tar-standard]: http://www.gnu.org/software/tar/manual/html_node/Standard.html
326+
[rfc1952]: https://tools.ietf.org/html/rfc1952
321327
[tar-archive]: https://en.wikipedia.org/wiki/Tar_(computing)
322-
[gzip]: http://www.zlib.org/rfc-gzip.html

manifest.md

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -54,11 +54,15 @@ Unlike the [Manifest List](manifest-list.md), which contains information about a
5454
This [descriptor property](descriptor.md#properties) has additional restrictions for `layers[]`.
5555
Implementations MUST support at least the following media types:
5656

57-
- [`application/vnd.oci.image.layer.v1.tar+gzip`](layer.md)
58-
- [`application/vnd.oci.image.layer.nondistributable.v1.tar+gzip`](layer.md#non-distributable-layers)
57+
- [`application/vnd.oci.image.layer.v1.tar`](layer.md)
58+
- [`application/vnd.oci.image.layer.v1.tar+gzip`](layer.md#gzip-media-types)
59+
- [`application/vnd.oci.image.layer.nondistributable.v1.tar`](layer.md#non-distributable-layers)
60+
- [`application/vnd.oci.image.layer.nondistributable.v1.tar+gzip`](layer.md#gzip-media-types)
5961

6062
Manifests concerned with portability SHOULD use one of the above media types.
6163

64+
Entries in this field will frequently use the `+gzip` types.
65+
6266
- **`annotations`** *string-string map*
6367

6468
This OPTIONAL property contains arbitrary metadata for the image manifest.

media-types.md

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,10 @@ The following media types identify the formats described here and their referenc
66
- `application/vnd.oci.image.manifest.list.v1+json`: [Manifest list](manifest-list.md#manifest-list)
77
- `application/vnd.oci.image.manifest.v1+json`: [Image manifest](manifest.md#image-manifest)
88
- `application/vnd.oci.image.config.v1+json`: [Image config](config.md)
9-
- `application/vnd.oci.image.layer.v1.tar+gzip`: ["Layer", as a gzipped tar archive](layer.md)
10-
- `application/vnd.oci.image.layer.nondistributable.v1.tar+gzip`: ["Layer", as a gzipped tar archive with distribution restrictions](layer.md#non-distributable-layers)
9+
- `application/vnd.oci.image.layer.v1.tar`: ["Layer", as a tar archive](layer.md)
10+
- `application/vnd.oci.image.layer.v1.tar+gzip`: ["Layer", as a tar archive](layer.md#gzip-media-types) compressed with [gzip][rfc1952]
11+
- `application/vnd.oci.image.layer.nondistributable.v1.tar`: ["Layer", as a tar archive with distribution restrictions](layer.md#non-distributable-layers)
12+
- `application/vnd.oci.image.layer.nondistributable.v1.tar+gzip`: ["Layer", as a tar archive with distribution restrictions](layer.md#gzip-media-types) compressed with [gzip][rfc1952]
1113

1214
## Media Type Conflicts
1315

@@ -41,7 +43,7 @@ This section shows where the OCI Image Specification is compatible with formats
4143

4244
- [application/vnd.docker.distribution.manifest.v2+json](https://github.com/docker/distribution/blob/master/docs/spec/manifest-v2-2.md#image-manifest-field-descriptions)
4345

44-
### application/vnd.oci.image.rootfs.tar.gzip
46+
### application/vnd.oci.image.layer.v1.tar+gzip
4547

4648
**Interchangeable and fully compatible mime-types**
4749

@@ -61,3 +63,5 @@ The following figure shows how the above media types reference each other:
6163

6264
[Descriptors](descriptor.md) are used for all references.
6365
The manifest list being a "fat manifest" references one or more image manifests per target platform. An image manifest references exactly one target configuration and possibly many layers.
66+
67+
[rfc1952]: https://tools.ietf.org/html/rfc1952

specs-go/v1/mediatype.go

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,11 +25,20 @@ const (
2525
MediaTypeImageManifestList = "application/vnd.oci.image.manifest.list.v1+json"
2626

2727
// MediaTypeImageLayer is the media type used for layers referenced by the manifest.
28-
MediaTypeImageLayer = "application/vnd.oci.image.layer.v1.tar+gzip"
28+
MediaTypeImageLayer = "application/vnd.oci.image.layer.v1.tar"
29+
30+
// MediaTypeImageLayerGzip is the media type used for gzipped layers
31+
// referenced by the manifest.
32+
MediaTypeImageLayerGzip = "application/vnd.oci.image.layer.v1.tar+gzip"
2933

3034
// MediaTypeImageLayerNonDistributable is the media type for layers referenced by
3135
// the manifest but with distribution restrictions.
32-
MediaTypeImageLayerNonDistributable = "application/vnd.oci.image.layer.nondistributable.v1.tar+gzip"
36+
MediaTypeImageLayerNonDistributable = "application/vnd.oci.image.layer.nondistributable.v1.tar"
37+
38+
// MediaTypeImageLayerNonDistributableGzip is the media type for
39+
// gzipped layers referenced by the manifest but with distribution
40+
// restrictions.
41+
MediaTypeImageLayerNonDistributableGzip = "application/vnd.oci.image.layer.nondistributable.v1.tar+gzip"
3342

3443
// MediaTypeImageConfig specifies the media type for the image configuration.
3544
MediaTypeImageConfig = "application/vnd.oci.image.config.v1+json"

0 commit comments

Comments
 (0)