Skip to content

Commit 16af37e

Browse files
committed
media-types: Define '+gzip' structured syntax suffix
Leaning heavily on the existing entries in RFC 6839. The suffix makes it easy to clarify DiffIDs without requiring a particular layer media type. It also allows you to create image-layout instances where the layers are stored uncompressed, which may be useful for cases such as: * Binary diffing between layer blobs for cheaper updates of large layers [1]. * Compressing an image-layout tarball for a smaller smaller overall tarball (by avoiding the unnecessary fragmentation of compressing the individual blob entries). [1]: http://ircbot.wl.linuxfoundation.org/eavesdrop/%23opencontainers/%23opencontainers.2016-08-16.log.html#t2016-08-16T23:35:43 Signed-off-by: W. Trevor King <[email protected]>
1 parent 287772a commit 16af37e

File tree

5 files changed

+53
-11
lines changed

5 files changed

+53
-11
lines changed

config.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,8 @@ This specification uses the following terms:
3232
<dd>
3333
A layer DiffID is a SHA256 digest over the layer's uncompressed tar archive and serialized in the descriptor digest format, e.g., <code>sha256:a9561eb1b190625c9adb5a9513e72c4dedafc1cb2d4c5236c9a6957ec7dfd5a9</code>.
3434
Layers must be packed and unpacked reproducibly to avoid changing the layer ID, for example by using tar-split to save the tar headers.
35-
NOTE: the DiffID is different than the digest in the manifest list because the manifest digest is taken over the gzipped layer for <code>application/vnd.oci.image.layer.tar+gzip</code> types.
35+
The DiffID is different than the layer digest in the <a href="manifest.md#image-manifest-property-descriptions">manifest's <code>layers</code></a> because the layer digest is taken over the blob regardless of compression, while the DiffID is taken after removing any compression.
36+
For an <code>application/vnd.oci.image.layer.tar+gzip</code> layer, the layer digest is taken over the <code>application/vnd.oci.image.layer.tar+gzip</code> content, while the DiffID is take over the <code>application/vnd.oci.image.layer.tar</code> content.
3637
</dd>
3738
<dt>
3839
Layer ChainID

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.tar+gzip\napplication/vnd.oci.image.layer.nondistributable.tar+gzip"]
6+
layer [shape=note, label="Layer tar archive\napplication/vnd.oci.image.layer.tar\napplication/vnd.oci.image.layer.nondistributable.tar"]
77
}
88

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

layer.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,8 @@ This document will use a concrete example to illustrate how to create and consum
66

77
## Distributable Format
88

9-
Layer Changesets for the [mediatype](./media-types.md) `application/vnd.oci.image.layer.tar+gzip` MUST be packaged in [tar archive][tar-archive].
10-
Layer Changesets for the [mediatype](./media-types.md) `application/vnd.oci.image.layer.tar+gzip` MUST NOT include duplicate entries for file paths in the resulting [tar archive][tar-archive].
9+
Layer Changesets for the [mediatype](./media-types.md) `application/vnd.oci.image.layer.tar` MUST be packaged in [tar archive][tar-archive].
10+
Layer Changesets for the [mediatype](./media-types.md) `application/vnd.oci.image.layer.tar` MUST NOT include duplicate entries for file paths in the resulting [tar archive][tar-archive].
1111

1212
## Change Types
1313

@@ -170,7 +170,7 @@ Where the basename name of `./etc/my-app-config` is now prefixed with `.wh.`, an
170170

171171
## Applying
172172

173-
Layer Changesets of [mediatype](./media-types.md) `application/vnd.oci.image.layer.tar+gzip` are applied rather than strictly extracted in normal fashion for tar archives.
173+
Layer Changesets of [mediatype](./media-types.md) `application/vnd.oci.image.layer.tar` are applied rather than strictly extracted in normal fashion for tar archives.
174174

175175
Applying a layer changeset requires consideration for the [whiteout](#whiteouts) files.
176176
In the absence of any [whiteout](#whiteouts) files in a layer changeset, the archive is extracted like a regular tar archive.
@@ -275,7 +275,7 @@ Any given image is likely to be composed of several of these Image Filesystem Ch
275275
Certain layers, due to legal requirements, may not be regularly distributable.
276276
Typically, such layers are downloaded directly from a distributor but are never uploaded.
277277

278-
Layers that have these restrictions SHOULD be tagged with an alternative mediatype of `application/vnd.oci.image.layer.nondistributable.tar+gzip`.
278+
Layers that have these restrictions SHOULD be tagged with an alternative mediatype of `application/vnd.oci.image.layer.nondistributable.tar`.
279279
[Descriptors](descriptor.md) referencing these layers MAY include `urls` for downloading these layers.
280280
It is implementation-defined whether or not implementations upload layers tagged with this media type.
281281

media-types.md

Lines changed: 44 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,45 @@ The following media types identify the formats described here and their referenc
66
- `application/vnd.oci.image.manifest.list.v1+json`: [Manifest list](manifest.md#manifest-list)
77
- `application/vnd.oci.image.manifest.v1+json`: [Image manifest format](manifest.md#image-manifest)
88
- `application/vnd.oci.image.config.v1+json`: [Container config JSON](config.md)
9-
- `application/vnd.oci.image.layer.tar+gzip`: ["Layer", as a gzipped tar archive](layer.md)
10-
- `application/vnd.oci.image.layer.nondistributable.tar+gzip`: ["Layer", as a gzipped tar that has distribution restrictions](layer.md#non-distributable-layers)
9+
- `application/vnd.oci.image.layer.tar`: ["Layer", as a tar archive](layer.md)
10+
- `application/vnd.oci.image.layer.nondistributable.tar`: ["Layer", as a tar archive with distribution restrictions](layer.md#non-distributable-layers)
11+
12+
## Suffixes
13+
14+
[RFC 6839][rfc6839] defines several structured syntax suffixes for use with media types.
15+
This section adds additional structured syntax suffixes for use with media types in OCI Image contexts.
16+
17+
### The +gzip Structured Syntax Suffix
18+
19+
[GZIP][rfc1952] is a widely used compression format.
20+
The media type [`application/gzip`][rfc6713] has been registered for such files.
21+
The suffix `+gzip` MAY be used with any media type whose representation follows that established for `application/gzip`.
22+
The media type structured syntax suffix registration form follows:
23+
24+
Name: GZIP file format
25+
26+
`+suffix`: `+gzip`
27+
28+
References: [[GZIP][rfc1952]]
29+
30+
Encoding considerations: GZIP is a binary encoding.
31+
32+
Fragment identifier considerations:
33+
34+
The syntax and semantics of fragment identifiers specified for `+gzip` SHOULD be as specified for `application/gzip`.
35+
(At publication of this document, there is no fragment identification syntax defined for `application/gzip`.)
36+
The syntax and semantics for fragment identifiers for a specific `xxx/yyy+gzip` SHOULD be processed as follows:
37+
38+
* For cases defined in `+gzip`, where the fragment identifier resolves per the `+gzip` rules, then process as specified in `+gzip`.
39+
* For cases defined in `+gzip`, where the fragment identifier does not resolve per the `+gzip` rules, then process as specified in `xxx/yyy+gzip`.
40+
* For cases not defined in `+gzip`, then process as specified in `xxx/yyy+gzip`.
41+
42+
Interoperability considerations: n/a
43+
44+
Security considerations:
45+
46+
See the "Security Considerations" sections of [RFC 1952][rfc1952] and [RFC 6713][rfc6713].
47+
Each individual media type registered with a `+gzip` suffix can have additional security considerations.
1148

1249
## Compatibility Matrix
1350

@@ -27,7 +64,7 @@ This section shows where the OCI Image Specification is compatible with formats
2764

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

30-
### application/vnd.oci.image.rootfs.tar.gzip
67+
### application/vnd.oci.image.layer.tar
3168

3269
**Interchangeable and fully compatible mime-types**
3370

@@ -47,3 +84,7 @@ The following figure shows how the above media types reference each other:
4784

4885
A reference is defined as the target content digest, as defined by the [Registry V2 HTTP API Specificiation](https://docs.docker.com/registry/spec/api/#digest-parameter).
4986
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.
87+
88+
[rfc1952]: https://tools.ietf.org/html/rfc1952
89+
[rfc6713]: https://tools.ietf.org/html/rfc6713
90+
[rfc6839]: https://tools.ietf.org/html/rfc6839

specs-go/v1/mediatype.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,11 +25,11 @@ 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.tar+gzip"
28+
MediaTypeImageLayer = "application/vnd.oci.image.layer.tar"
2929

3030
// MediaTypeImageLayerNonDistributable is the media type for layers referenced by
3131
// the manifest but with distribution restrictions.
32-
MediaTypeImageLayerNonDistributable = "application/vnd.oci.image.layer.nondistributable.tar+gzip"
32+
MediaTypeImageLayerNonDistributable = "application/vnd.oci.image.layer.nondistributable.tar"
3333

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

0 commit comments

Comments
 (0)