Skip to content

Commit 923813e

Browse files
author
Doug Davis
committed
Part 2
Signed-off-by: Doug Davis <dug@us.ibm.com>
1 parent c7b6c60 commit 923813e

File tree

1 file changed

+33
-25
lines changed

1 file changed

+33
-25
lines changed

image.md

Lines changed: 33 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -9,66 +9,76 @@ Images are meant to be portable such that they can be used to reliably move file
99
A compliant image contains the following pieces of information:
1010

1111
1. An OCI [`config.json`](config.md) file.
12-
This file is REQUIRED to be present in the image, unless this image is a dependent image, in which case it is OPTIONAL.
12+
This file is REQUIRED to be present in the image.
1313
The `config.json` file contains the host independent configuration information necessary to execute the container.
1414
See [`config.json`](config.md) for more information.
1515

16-
1. The root filesystem of the filesystem bundle.
17-
This directory MUST be present in the image, however it MAY be empty (not contain any files or folders).
18-
As specified in the `config.json` file, this directory contains the files that make up the root filesystem of the container.
19-
This directory MAY contain only a portion of the complete set of files that make up the filesystem bundle, in which case the remaining set of files MUST be found in one of the dependent images.
20-
2116
1. References to dependent images.
2217
If present, this OPTIONAL information MUST be in a file called `required.json`.
2318
This file MUST be a JSON encoded array of references to images as specified in the [Dependent Images](#dependent-images) section.
2419

2520
1. Dependent images.
26-
An image MAY choose to include dependent images as directories within the image.
27-
If present, each dependent image MUST be placed in a directory whose name is the same as its ID.
28-
Within each directory MUST be a complete OCI compliant image definition.
29-
Note that within each dependent image's directory there MAY be a whiteout.json file.
21+
An image MAY include dependent images as directories within the image.
22+
Each dependent image MUST be placed in a directory whose name is the same as its ID (see the [IDs](#ids) section for more details about IDs).
23+
The contents of each directory MUST adhere to the following:
24+
a. there MUST be a directory called `rootfs` which contains the root filesystem of that image.
25+
a. there MAY be a `whiteout.json` file (see [Whiteout List](#whiteout-list)).
26+
a. there MAY be additional "extension files".
27+
The ID MUST be generated over the above contents in the order specified.
28+
29+
1. The root filesystem of the filesystem bundle.
30+
This directory MUST be present in the image, however it MAY be empty (not contain any files or folders).
31+
As specified in the `config.json` file, this directory contains the files that make up the root filesystem of the container.
32+
This directory MAY contain only a portion of the complete set of files that make up the filesystem bundle, in which case the remaining set of files MUST be found in one of the dependent images.
3033

3134
1. Whiteout list.
32-
An image MAY choose to include a list of files that are to be considered to be deleted from the root filesystem even though they are included within the image's root filesystem directory.
35+
An image MAY choose to include a list of files that are to be considered to be deleted from dependent images even though they are included within the dependent image's root filesystem directory.
3336
It is an implementation detail to decide how this whiteout list is processed but an implementation MUST ensure that any container that is created from this image will behave the same as if those files were not in the root filesystem at all.
3437
The whiteout list MUST be in a file called `whiteout.json`.
3538
See the [Whiteout List](#whiteout-list) section for more details.
3639

40+
1. ID of the root filesystem.
41+
This data MUST be a cryptographic hash of the root filesystem directory (including the directory itself) and the whiteout list file, in that order.
42+
If there are dependent images then this MUST NOT include the dependent image's data.
43+
This REQUIRED information MUST be in a file called `rootfs.ID`
44+
See the [IDs](#ids) section for more details.
45+
3746
1. Extension files.
3847
An image MAY choose to include additional files and directories in the image.
3948

4049
1. The ID of the image.
50+
This data MUST be a cryptographic hash of all the data listed above, in the order specified.
51+
For the purposes of calculating the ID, the order of processing the extension files MUST be in case-sensitive alphabetical order.
4152
This REQUIRED information MUST be in a file called `ID`.
42-
See the [Image ID](#image-id) section for more details.
53+
See the [IDs](#ids) section for more details.
4354

4455
## Serialization of an Image
4556

4657
An image MUST be a `tar` of the pieces of data that make up an image as specified in the [Image Contents](#image-contents) section.
4758
The order in which the data is serialized in the `tar` MUST be the same as the order specified in that section.
48-
The serialization of the "dependent images" MUST be in the same order in which those dependent images are listed in the `requires.json` file.
59+
The serialization of the "dependent images" directories, if any, MUST be in the same order in which those dependent images are listed in the `requires.json` file.
4960
The serialization of the "extension files" MUST be in case-sensitive alphabetical order.
61+
Note that "extension files", irrespective of their names, MUST appear after the `rootfs.ID` file for the image.
5062

5163
Each file or directory specified in the [Image Contents](#image-contents) section MUST appear at the root of the `tar` without a leading `/` in their names.
5264

5365
For example, a listing of the `tar` of an image might look like this:
5466
```
5567
config.json
56-
rootfs/
57-
bin/myapp
5868
requires.json
5969
sha512-1d62d181e9c1322d56ccd3a29d05018399147a16188dbd861c0279ad0dd7e14c/
60-
config.json
6170
rootfs/
6271
bin/runit
63-
whiteout.json
64-
ID
6572
sha512-291e2a171ef9bef8a838c59406d9b0aeb6f2f0ebe5173415205733d3d18b8e03/
66-
config.json
6773
rootfs/
6874
bin/monitor
6975
whiteout.json
70-
ID
76+
sha512-98364ca873540185d83645e93745a94847f2f0ebe51733987154840afebc9921/
77+
rootfs/
78+
bin/myapp
7179
whiteout.json
80+
rootfs.ID
81+
extraFile
7282
ID
7383
```
7484

@@ -92,11 +102,11 @@ The `requires.json` file MUST be a JSON encoded array matching this format:
92102
The order of the images, `ID`s, in the array MUST be in the order in which the images are to be "layed down" into the filesystem bundle that is generated from this image.
93103
In other words, the first image in the array is written to the filesystem first, and subsequent images are overlayed on top - potentially overlaying an ealier image's files.
94104

95-
## Image ID
105+
## IDs
96106

97-
An image's `ID` MUST be a cryptographic hash of image's contents in the order specified in the [Image Contents](#image-contents) section.
107+
An `ID` MUST be a cryptographic hash of the data being protected, in the order specified for that ID.
98108

99-
An image's `ID` MUST be a string of the form `<algorithm>-<hash value>`.
109+
An `ID` MUST be a string of the form `<algorithm>-<hash value>`.
100110
The `algorithm` part of the string MUST be in lower-case.
101111
For example, `sha512` not `SHA512`.
102112

@@ -123,8 +133,6 @@ The contents of this directory MUST appear to be materizlied in such a way as to
123133
The exact mechanism, process and order, by which those files are materialized on disk is an implementation detail, however in the end it MUST appear as though all of the files from the images were written to disk in the order they were specified in the `requires.json` file.
124134
This means that each dependent image's `whiteout.json` file MUST appear to be processed during the materialization of that image so that if a subsequent image creates a file by the same name as one mentioned in the `whiteout.json` file then it will not be deleted.
125135

126-
The `config.json` file of any dependent images, if present, are ignored by the expansion process.
127-
128136
This specification does not mandate any requirements on the processing of the extension files.
129137
In other words, implementations are not required to materialize them on disk in the filesystem bundle.
130138

0 commit comments

Comments
 (0)