You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The idea with a spec like this is to define behavior so that different
implementations can interoperate reliably. When there is an interop
problem betweem implementations A and B, it should be clear from the
spec whether implementation A is broken, implementation B is broken,
or the spec is insufficiently clear.
For example, pax defines 'g' and 'x' typeflags [1] that aren't part of
the older ustar (IEEE Std 1003.1-1988) [2]. Before this commit, if
implementation A produced a layer with a 'g' or 'x' typeflag and
implementation B died unpacking it, it was unclear whose fault it was.
With this commit, it is clearly B's fault (because it does not
understand the pax typeflag).
If implementation A had produces a layer with an 'S' typeflag (which
GNU uses for sparse files [3]) and implementation B died unpacking it,
it is neither party's fault, because pax explicitly makes those values
implementation-defined. Interop around them is up to out of band
communication between the layer author and layer consumer, and is not
covered by this spec.
The previous "File Types" section listed sockets, but the pax spec has:
Attempts to archive a socket using ustar interchange format shall
produce a diagnostic message.
And I see no socket entry in Go's set of tar-type constants [4], so
I'm not sure how they were supported before.
It looks like Go has supported pax since v1.1 [5,6].
[1]: http://pubs.opengroup.org/onlinepubs/9699919799/utilities/pax.html#tag_20_92_13_02
[2]: https://github.com/libarchive/libarchive/wiki/ManPageTar5#POSIX_ustar_Archives
[3]: https://github.com/libarchive/libarchive/wiki/ManPageTar5#gnu-tar-archives
[4]: https://golang.org/pkg/archive/tar/#pkg-constants
[5]: https://codereview.appspot.com/6700047
[6]: golang/go@1068279
Signed-off-by: W. Trevor King <[email protected]>
Copy file name to clipboardExpand all lines: config.md
+3-3Lines changed: 3 additions & 3 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -13,7 +13,7 @@ This specification uses the following terms:
13
13
</dt>
14
14
<dd>
15
15
Image filesystems are composed of <i>layers</i>.
16
-
Each layer represents a set of filesystem changes in a tar-based <a href="layer.md">layer format</a>, recording files to be added, changed, or deleted relative to its parent layer.
16
+
Each layer represents a set of filesystem changes in a pax-based <a href="layer.md">layer format</a>, recording files to be added, changed, or deleted relative to its parent layer.
17
17
Layers do not have configuration metadata such as environment variables or default arguments - these are properties of the image as a whole rather than any particular layer.
18
18
Using a layer-based or union filesystem such as AUFS, or by computing the diff from filesystem snapshots, the filesystem changeset can be used to present a series of image layers as if they were one cohesive filesystem.
19
19
</dd>
@@ -30,8 +30,8 @@ This specification uses the following terms:
30
30
Layer DiffID
31
31
</dt>
32
32
<dd>
33
-
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>.
34
-
Layers must be packed and unpacked reproducibly to avoid changing the layer ID, for example by using tar-split to save the tar headers.
33
+
A layer DiffID is a SHA256 digest over the layer's uncompressed pax archive and serialized in the descriptor digest format, e.g., <code>sha256:a9561eb1b190625c9adb5a9513e72c4dedafc1cb2d4c5236c9a6957ec7dfd5a9</code>.
34
+
Layers must be packed and unpacked reproducibly to avoid changing the layer ID, for example by using tar-split to save the pax headers.
35
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.
Copy file name to clipboardExpand all lines: layer.md
+18-38Lines changed: 18 additions & 38 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -6,8 +6,13 @@ This document will use a concrete example to illustrate how to create and consum
6
6
7
7
## Distributable Format
8
8
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 have the [media type](media-types.md)`application/vnd.oci.image.layer.tar+gzip`.
10
+
Layer changesets MUST be packaged in the pax interchange format, as [specified by IEEE Std 1003.1-2013][pax], and compressed using gzip, as [specified by RFC 1952][rfc1952].
11
+
Layer changesets MUST NOT include duplicate entries for target paths (`path` from the pax extended header or the value computed from `prefix` and `name` in the ustar header).
12
+
13
+
Portable layers SHOULD NOT use features that [IEEE Std 1003.1-2013][pax] leaves unspecified, undefined, or implementation-defined.
14
+
For example, pax reserves `typeflag` values A through Z for custom implementations, so support for unpacking such entries may be mixed.
15
+
[Sparse files](https://en.wikipedia.org/wiki/Sparse_file) SHOULD NOT be used because they [are a GNU extension][tar.5-gnu].
11
16
12
17
## Change Types
13
18
@@ -17,37 +22,10 @@ Types of changes that can occur in a changeset are:
17
22
* Modifications
18
23
* Removals
19
24
20
-
Additions and Modifications are represented the same in the changeset tar archive.
25
+
Additions and Modifications are have the same representation in the pax archive.
21
26
22
27
Removals are represented using "[whiteout](#whiteouts)" file entries (See [Representing Changes](#representing-changes)).
23
28
24
-
### File Types
25
-
26
-
Throughout this document section, the use of word "files" or "entries" includes:
27
-
28
-
* regular files
29
-
* directories
30
-
* sockets
31
-
* symbolic links
32
-
* block devices
33
-
* character devices
34
-
* FIFOs
35
-
36
-
### File Attributes
37
-
38
-
Where supported, MUST include file attributes for Additions and Modifications include:
39
-
40
-
* Modification Time (`mtime`)
41
-
* User ID (`uid`)
42
-
* User Name (`uname`) *secondary to `uid`*
43
-
* Group ID (`gid `)
44
-
* Group Name (`gname`) *secondary to `gid`*
45
-
* Mode (`mode`)
46
-
* Extended Attributes (`xattrs`)
47
-
* Symlink reference (`linkname`)
48
-
49
-
[Sparse files](https://en.wikipedia.org/wiki/Sparse_file) SHOULD NOT be used because they lack consistent support across tar implementations.
50
-
51
29
## Creating
52
30
53
31
### Initial Root Filesystem
@@ -76,7 +54,7 @@ rootfs-c9d-v1/
76
54
my-app-tools
77
55
```
78
56
79
-
The `rootfs-c9d-v1` directory is then created as a plain [tar archive][tar-archive] with relative path to `rootfs-c9d-v1`.
57
+
The `rootfs-c9d-v1` directory is then created as a plain [pax archive][pax] with paths relative to `rootfs-c9d-v1`.
80
58
Entries for the following files:
81
59
82
60
```
@@ -91,7 +69,7 @@ Entries for the following files:
91
69
### Populate a Comparison Filesystem
92
70
93
71
Create a new directory and initialize it with a copy or snapshot of the prior root filesystem.
94
-
Example commands that can preserve [file attributes](#file-attributes) to make this copy are:
72
+
Example commands that can preserve [file attributes][pax] to make this copy are:
95
73
*[cp(1)](http://linux.die.net/man/1/cp): `cp -a rootfs-c9d-v1/ rootfs-c9d-v1.s1/`
*[tar(1)](http://linux.die.net/man/1/tar): `mkdir rootfs-c9d-v1.s1 && tar --acls --xattrs -C rootfs-c9d-v1/ -c . | tar -C rootfs-c9d-v1.s1/ --acls --xattrs -x` (including `--selinux` where supported)
@@ -152,12 +130,12 @@ This reflects the removal of `/etc/my-app-config` and creation of a file and dir
152
130
153
131
### Representing Changes
154
132
155
-
A [tar archive][tar-archive] is then created which contains *only* this changeset:
133
+
A [pax archive][pax] is then created which contains *only* this changeset:
156
134
157
135
- Added and modified files and directories in their entirety
158
136
- Deleted files or directories marked with a [whiteout file](#whiteouts)
159
137
160
-
The resulting tar archive for `rootfs-c9d-v1.s1` has the following entries:
138
+
The resulting pax archive for `rootfs-c9d-v1.s1` has the following entries:
161
139
162
140
```
163
141
./etc/my-app.d/
@@ -170,10 +148,10 @@ Where the basename name of `./etc/my-app-config` is now prefixed with `.wh.`, an
170
148
171
149
## Applying
172
150
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.
151
+
Layer Changesets of [mediatype](./media-types.md)`application/vnd.oci.image.layer.tar+gzip` are applied rather than strictly extracted in normal fashion for pax archives.
174
152
175
153
Applying a layer changeset requires consideration for the [whiteout](#whiteouts) files.
176
-
In the absence of any [whiteout](#whiteouts) files in a layer changeset, the archive is extracted like a regular tar archive.
154
+
In the absence of any [whiteout](#whiteouts) files in a layer changeset, the archive is extracted like a regular pax archive.
177
155
178
156
179
157
### Changeset over existing files
@@ -268,7 +246,7 @@ Note that this opaque file will apply to _all_ children, including sub-directori
268
246
269
247
Implementations SHOULD generate layers using _explicit whiteout_ files, but MUST accept both.
270
248
271
-
Any given image is likely to be composed of several of these Image Filesystem Changeset tar archives.
249
+
Any given image is likely to be composed of several of these layers.
272
250
273
251
# Non-Distributable Layers
274
252
@@ -279,4 +257,6 @@ Layers that have these restrictions SHOULD be tagged with an alternative mediaty
279
257
[Descriptors](descriptor.md) referencing these layers MAY include `urls` for downloading these layers.
280
258
It is implementation-defined whether or not implementations upload layers tagged with this media type.
-`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+gzip`: ["Layer", as a gzipped pax archive](layer.md)
10
+
-`application/vnd.oci.image.layer.nondistributable.tar+gzip`: ["Layer", as a gzipped pax that has distribution restrictions](layer.md#non-distributable-layers)
0 commit comments