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
Implementations storing or copying content MUST NOT modify or alter the content in a way that would change the digest of the content. Examples of these implementations include:
4
-
* A [registry implementing the distribution specification](https://github.com/opencontainers/distribution-spec/blob/main/spec.md#definitions), including local registries, caching proxies
5
-
* An application which copies content to disk or between registries
4
+
5
+
- A [registry implementing the distribution specification][distribution-spec], including local registries, caching proxies
6
+
- An application which copies content to disk or between registries
6
7
7
8
Implementations processing content SHOULD NOT generate an error if they encounter an unknown property in a known media type. Examples of these implementations include:
8
-
* A [runtime implementing the runtime specification](https://github.com/opencontainers/runtime-spec/blob/main/spec.md)
9
-
* An implementation using OCI to retrieve and utilize artifacts, e.g.: a WASM runtime
9
+
10
+
- A [runtime implementing the runtime specification][runtime-spec]
11
+
- An implementation using OCI to retrieve and utilize artifacts, e.g.: a WASM runtime
10
12
11
13
# Canonicalization
12
14
13
-
* OCI Images are [content-addressable](https://en.wikipedia.org/wiki/Content-addressable_storage). See [descriptors](descriptor.md) for more.
14
-
* One benefit of content-addressable storage is easy deduplication.
15
-
* Many images might depend on a particular [layer](layer.md), but there will only be one blob in the [store](image-layout.md).
16
-
* With a different serialization, that same semantic layer would have a different hash, and if both versions of the layer are referenced there will be two blobs with the same semantic content.
17
-
* To allow efficient storage, implementations serializing content for blobs SHOULD use a canonical serialization.
18
-
* This increases the chance that different implementations can push the same semantic content to the store without creating redundant blobs.
15
+
- OCI Images are [content-addressable](https://en.wikipedia.org/wiki/Content-addressable_storage). See [descriptors](descriptor.md) for more.
16
+
- One benefit of content-addressable storage is easy deduplication.
17
+
- Many images might depend on a particular [layer](layer.md), but there will only be one blob in the [store](image-layout.md).
18
+
- With a different serialization, that same semantic layer would have a different hash, and if both versions of the layer are referenced there will be two blobs with the same semantic content.
19
+
- To allow efficient storage, implementations serializing content for blobs SHOULD use a canonical serialization.
20
+
- This increases the chance that different implementations can push the same semantic content to the store without creating redundant blobs.
19
21
20
22
## JSON
21
23
22
-
[JSON][] content SHOULD be serialized as [canonical JSON][canonical-json].
24
+
[JSON][JSON] content SHOULD be serialized as [canonical JSON][canonical-json].
23
25
Of the [OCI Image Format Specification media types](media-types.md), all the types ending in `+json` contain JSON content.
24
26
Implementations:
25
27
26
-
*[Go][]: [github.com/docker/go][], which claims to implement [canonical JSON][canonical-json] except for Unicode normalization.
-[Go][Go]: [github.com/docker/go][docker-go], which claims to implement [canonical JSON][canonical-json] except for Unicode normalization.
32
29
33
30
# EBNF
34
31
35
32
For field formats described in this specification, we use a limited subset of [Extended Backus-Naur Form][ebnf], similar to that used by the [XML specification][xmlebnf].
36
33
Grammars present in the OCI specification are regular and can be converted to a single regular expressions.
37
-
However, regular expressions are avoided to limit abiguity between regular expression syntax.
34
+
However, regular expressions are avoided to limit ambiguity between regular expression syntax.
38
35
By defining a subset of EBNF used here, the possibility of variation, misunderstanding or ambiguities from linking to a larger specification can be avoided.
39
36
40
37
Grammars are made up of rules in the following form:
41
38
42
-
```
39
+
```ebnf
43
40
symbol ::= expression
44
41
```
45
42
@@ -50,14 +47,14 @@ Whitespace is completely ignored in rule definitions.
50
47
51
48
The simplest expression is the literal, surrounded by quotes:
52
49
53
-
```
50
+
```ebnf
54
51
literal ::= "matchthis"
55
52
```
56
53
57
54
The above expression defines a symbol, "literal", that matches the exact input of "matchthis".
58
55
Character classes are delineated by brackets (`[]`), describing either a set, range or multiple range of characters:
59
56
60
-
```
57
+
```ebnf
61
58
set := [abc]
62
59
range := [A-Z]
63
60
```
@@ -67,7 +64,7 @@ The symbol "range" would match any character, "A" to "Z", inclusive.
67
64
Currently, only matching for 7-bit ascii literals and character classes is defined, as that is all that is required by this specification.
68
65
Multiple character ranges and explicit characters can be specified in a single character classes, as follows:
69
66
70
-
```
67
+
```ebnf
71
68
multipleranges := [a-zA-Z=-]
72
69
```
73
70
@@ -77,31 +74,31 @@ Expressions can be made up of one or more expressions, such that one must be fol
77
74
This is known as an implicit concatenation operator.
78
75
For example, to satisfy the following rule, both `A` and `B` must be matched to satisfy the rule:
79
76
80
-
```
77
+
```ebnf
81
78
symbol ::= A B
82
79
```
83
80
84
81
Each expression must be matched once and only once, `A` followed by `B`.
85
82
To support the description of repetition and optional match criteria, the postfix operators `*` and `+` are defined.
86
-
`*` indicates that the preceeding expression can be matched zero or more times.
87
-
`+` indicates that the preceeding expression must be matched one or more times.
83
+
`*` indicates that the preceding expression can be matched zero or more times.
84
+
`+` indicates that the preceding expression must be matched one or more times.
88
85
These appear in the following form:
89
86
90
-
```
87
+
```ebnf
91
88
zeroormore ::= expression*
92
89
oneormore ::= expression+
93
90
```
94
91
95
92
Parentheses are used to group expressions into a larger expression:
96
93
97
-
```
94
+
```ebnf
98
95
group ::= (A B)
99
96
```
100
97
101
98
Like simpler expressions above, operators can be applied to groups, as well.
102
99
To allow for alternates, we also define the infix operator `|`.
103
100
104
-
```
101
+
```ebnf
105
102
oneof ::= A | B
106
103
```
107
104
@@ -118,14 +115,14 @@ The operator precedence is in the following order:
118
115
- Alternates `|`
119
116
120
117
The precedence can be better described using grouping to show equivalents.
121
-
Concatenation has higher precedence than alernates, such `A B | C D` is equivalent to `(A B) | (C D)`.
118
+
Concatenation has higher precedence than alternates, such `A B | C D` is equivalent to `(A B) | (C D)`.
122
119
Unary operators have higher precedence than alternates and concatenation, such that `A+ | B+` is equivalent to `(A+) | (B+)`.
123
120
124
121
## Examples
125
122
126
123
The following combines the previous definitions to match a simple, relative path name, describing the individual components:
127
124
128
-
```
125
+
```ebnf
129
126
path ::= component ("/" component)*
130
127
component ::= [a-z]+
131
128
```
@@ -134,9 +131,15 @@ The production "component" is one or more lowercase letters.
134
131
A "path" is then at least one component, possibly followed by zero or more slash-component pairs.
135
132
The above can be converted into the following regular expression:
0 commit comments