Skip to content

Commit 33d07f3

Browse files
committed
layer: clarify attributes for implied directories
The image specification currently does not describe how conformant implementations should handle the case of a layer that contains "implied directories" -- entries that imply parent directories exist through their path, without those parent directories having their own entires in the archive. As such, this behavior is currently implementation-defined and may not be consistent, even in the same implementation (e.g. moby/moby#44106). To resolve this, we explicitly define what behavior is expected in this situation, selecting 'neutral' attributes (e.g. using the container `USER`'s UID/GID, and using `0755` for mode, as derived from the default `umask(2)` of 0022). Signed-off-by: Bjorn Neergaard <bneergaard@mirantis.com>
1 parent 4df8887 commit 33d07f3

File tree

1 file changed

+14
-0
lines changed

1 file changed

+14
-0
lines changed

layer.md

+14
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,20 @@ Where supported, MUST include file attributes for Additions and Modifications in
6161

6262
[Sparse files](https://en.wikipedia.org/wiki/Sparse_file) SHOULD NOT be used because they lack consistent support across tar implementations.
6363

64+
#### Implied Directories
65+
66+
As the tar format describes directory hierarchies using a flat datastructure, it is possible to have so-called "implied directories" where not all parent directories implied by an entries' path in the archive have their own entry.
67+
68+
When applying a layer, implementations MUST create any parent directories implied by an entries' path, even if it is otherwise absent from the archive. Attributes of the created parent directories MUST be set as follows:
69+
70+
* `mtime` is set to the Unix epoch (`0`)
71+
* `uid` is set to the `0`
72+
* `gid` is set to the `0`
73+
* `mode` is set to `0755`
74+
* `xattrs` are empty
75+
76+
Layer authors SHOULD ensure directory entries are fully present for all directory hierarchies in their layers, as previous versions of this specification did not specify this behavior and results may be implementation defined.
77+
6478
#### Hardlinks
6579

6680
* Hardlinks are a [POSIX concept](https://pubs.opengroup.org/onlinepubs/9699919799/functions/link.html) for having one or more directory entries for the same file on the same device.

0 commit comments

Comments
 (0)