Skip to content

Commit 43d840e

Browse files
authored
Resolve several open issues (#206)
* Mini updates so far Signed-off-by: Peter Engelbert <[email protected]> * rest of the updates so far Signed-off-by: Peter Engelbert <[email protected]> * Slight modifications based on comments Signed-off-by: Peter Engelbert <[email protected]> * Address *-Content-Digest headers Signed-off-by: Peter Engelbert <[email protected]> * Revert to old wording pertaining to digests Signed-off-by: Peter Engelbert <[email protected]>
1 parent 55ebd32 commit 43d840e

File tree

1 file changed

+50
-36
lines changed

1 file changed

+50
-36
lines changed

spec.md

Lines changed: 50 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -28,11 +28,10 @@
2828

2929
The **Open Container Initiative Distribution Specification** (a.k.a. "OCI Distribution Spec") defines an API protocol to facilitate and standardize the distribution of content.
3030

31-
While this specification is designed to be agnostic to content types, much of it is centered around the distribution of container images.
32-
Many of the concepts here, such as "manifests" and "digests", are originally defined in the [Open Container Initiative Image Format Specification](https://github.com/opencontainers/image-spec) (a.k.a. "OCI Image Spec"),
33-
and the OCI Image is considered to be the primary supported artifact type.
31+
While OCI Image is the most prominent, the specification is designed to be agnostic of content types. Concepts such as "manifests" and "digests",
32+
are currently defined in the [Open Container Initiative Image Format Specification](https://github.com/opencontainers/image-spec) (a.k.a. "OCI Image Spec").
3433

35-
For guidance on how to apply this specification to other artifact types, please see the [Open Container Initiative Artifact Authors Guide](https://github.com/opencontainers/artifacts/blob/master/artifact-authors.md) (a.k.a. "OCI Artifacts").
34+
To support other artifact types, please see the [Open Container Initiative Artifact Authors Guide](https://github.com/opencontainers/artifacts) (a.k.a. "OCI Artifacts").
3635

3736
### Historical Context
3837

@@ -44,6 +43,11 @@ For relevant details and a history leading up to this specification, please see
4443
- [moby/moby#9015](https://github.com/moby/moby/issues/9015)
4544
- [docker/docker-registry#612](https://github.com/docker/docker-registry/issues/612)
4645

46+
#### Legacy Docker support HTTP headers
47+
48+
Because of the origins this specification, the client MAY encounter Docker-specific headers, such as `Docker-Content-Digest`,
49+
or `Docker-Distribution-API-Version`. These headers are OPTIONAL and clients SHOULD NOT depend on them.
50+
4751
### Definitions
4852

4953
Several terms are used frequently in this document and warrant basic definitions:
@@ -54,7 +58,7 @@ Several terms are used frequently in this document and warrant basic definitions
5458
- **Pull**: the act of downloading Blobs and Manifests from a Registry
5559
- **Blob**: the binary form of content that is stored by a Registry, addressable by a Digest
5660
- **Manifest**: a JSON document which defines an Artifact. Manifests are defined under the OCI Image Spec <sup>[apdx-2](#appendix)</sup>
57-
- **Config**: a section in the Manifest (and associated Blob) which contains Artifact metadata
61+
- **Config**: a blob referenced in the Manifest which contains Artifact metadata. Config is defined under the OCI Image Spec <sup>[apdx-4](#appendix)</sup>
5862
- **Artifact**: one conceptual piece of content stored as Blobs with an accompanying Manifest containing a Config
5963
- **Digest**: a unique identifier created from a cryptographic hash of a Blob's content. Digests are defined under the OCI Image Spec <sup>[apdx-3](#appendix)</sup>
6064
- **Tag**: a custom, human-readable Manifest identifier
@@ -72,7 +76,6 @@ TODO: more detail on workflows related
7276
A container engine would like to run verified image named "library/ubuntu", with the tag "latest".
7377
The engine contacts the registry, requesting the manifest for "library/ubuntu:latest".
7478
An untrusted registry returns a manifest.
75-
Before proceeding to download the individual layers, the engine verifies the manifest's signature, ensuring that the content was produced from a trusted source and no tampering has occurred.
7679
After each layer is downloaded, the engine verifies the digest of the layer, ensuring that the content matches that specified by the manifest.
7780

7881
### Resumable Push
@@ -98,7 +101,12 @@ If process A and B upload the same layer at the same time, both operations will
98101
Even in the case where both uploads are accepted, the registry may securely only store one copy of the layer since the computed digests match.
99102

100103
## Conformance
101-
TODO: add general text about artifact validation requirements
104+
105+
For more information on testing for conformance, please see the [conformance README](./conformance/README.md)
106+
107+
### Official Certification
108+
109+
Registry providers can self-certify by submitting conformance results to [opencontainers/oci-conformance](https://github.com/opencontainers/oci-conformance).
102110

103111
### Requirements
104112

@@ -111,10 +119,6 @@ Registries conforming to this specification MUST handle all APIs required by the
111119

112120
In order to test a registry's conformance against these workflow categories, please use the [conformance testing tool](./conformance/).
113121

114-
### Official Certification
115-
116-
Registry providers can self-certify by submitting conformance results to [opencontainers/oci-conformance](https://github.com/opencontainers/oci-conformance).
117-
118122
### Workflow Categories
119123

120124
#### Pull
@@ -128,10 +132,18 @@ To pull a manifest, perform a `GET` request to a url in the following form:
128132
`/v2/<name>/manifests/<reference>` <sup>[end-3](#endpoints)</sup>
129133

130134
`<name>` refers to the namespace of the repository. `<reference>` MUST be either (a) the digest of the manifest or (b) a tag name.
131-
The `<reference>` MUST NOT be in any other format.
135+
The `<reference>` MUST NOT be in any other format. Throughout this document, `<name>` MUST match the following regular expression:
136+
137+
`[a-z0-9]+([._-][a-z0-9]+)*(/[a-z0-9]+([._-][a-z0-9]+)*)*`
132138

133139
A GET request to an existing manifest URL MUST provide the expected manifest, with a response code that MUST be `200 OK`.
134140

141+
The `OCI-Content-Digest` header (or, as a fallback, `Docker-Content-Digest` header), if present on the response, returns the canonical
142+
digest of the uploaded blob which MAY differ from the provided digest. If the digest does differ, it MAY be the case that
143+
the hashing algorithms used do not match. See [Content Digests](./detail.md) for information on how to detect the hashing
144+
algorithm in use. Most clients MAY ignore the value, but if it is used, the client MUST verify the value against the uploaded
145+
blob data.
146+
135147
If the manifest is not found in the registry, the response code MUST be `404 Not Found`.
136148

137149
##### Pulling Blobs
@@ -185,7 +197,7 @@ Successful completion of the request MUST return either a `201 Created` or a `20
185197
Location: <blob-location>
186198
```
187199

188-
With `<blob-location>` being a pullable blob URL.
200+
Here, `<blob-location>` is a pullable blob URL.
189201

190202
---
191203

@@ -205,7 +217,8 @@ Location: <location>
205217

206218
The `<location>` MUST contain a UUID representing a unique session ID for the upload to follow.
207219

208-
Optionally, the location MAY be absolute (containing the protocol and/or hostname), or it MAY be relative (containing just the URL path).
220+
Optionally, the location MAY be absolute (containing the protocol and/or hostname), or it MAY be relative (containing just the URL path). For more information,
221+
see [RFC 7231](https://tools.ietf.org/html/rfc7231#section-7.1.2).
209222

210223
Once the `<location>` has been obtained, perform the upload proper by making a `PUT` request to the following URL path, and with the following headers and body:
211224

@@ -308,24 +321,24 @@ Here, `<blob-location>` is a pullable blob URL.
308321
If a necessary blob exists already in another repository, it can be mounted into a different repository via a `POST`
309322
request in the following format:
310323

311-
`/v2/<name>/blobs/uploads/?mount=<digest>&from=<other_namespace>` <sup>[end-11](#endpoints)</sup>.
324+
`/v2/<name>/blobs/uploads/?mount=<digest>&from=<repository_name>` <sup>[end-11](#endpoints)</sup>.
312325

313326
In this case, `<name>` is the namespace to which the blob will be mounted. `<digest>` is the digest of the blob to mount,
314-
and `<other_namespace>` is the namespace from which the blob should be mounted.
327+
and `<repository_name>` is the namespace from which the blob should be mounted. This step is usually taken in place of the
328+
previously-described `POST` request to `/v2/<name>/blobs/uploads/` <sup>[end-4a](#endpoints)</sup> (which is used to initiate an
329+
upload session).
315330

316331
The response to a successful mount MUST be `201 Created`, and MUST contain the following header:
317332
```
318333
Location: <blob-location>
319334
```
320335

321-
The digest contained in the `Location` header MAY be different from that of the blob that was mounted. As such, a client
322-
SHOULD use the digest found in the path from this header and SHOULD NOT use the digest of the blob that was mounted.
336+
The Location header will contain the registry URL to access the accepted layer file. The Docker-Content-Digest
337+
header returns the canonical digest of the uploaded blob which MAY differ from the provided digest. Most clients MAY
338+
ignore the value but if it is used, the client SHOULD verify the value against the uploaded blob data.
323339

324-
The response to an unsuccessful mount MUST be `202 Accepted`, and be handled in the same way as a `POST` request to
325-
`/v2/<name>/blobs/uploads/`<sup>[end-4a](#endpoints)</sup>. That is, it MUST contain the following header, in the following format:
326-
```
327-
Location: /v2/<name>/blobs/uploads/<session-id>
328-
```
340+
Alternatively, if a registry does not support cross-repository mounting or is unable to mount the requested blob,
341+
it SHOULD return a `202`. This indicates that the upload session has begun and that the client MAY proceed with the upload.
329342

330343
##### Pushing Manifests
331344

@@ -384,11 +397,11 @@ In this case, the path will look like the following:
384397

385398
`<name>` is the namespace of the repository, and `<int>` is an integer specifying the number of tags requested. The response
386399
to such a request MAY return fewer than `<int>` results, but only when the total number of tags attached to the repository
387-
is less than `<int>`. Otherwise, the response MUST include `<int>` results. Without the `last` query parameter (described
388-
next), the list returned will start at the beginning of the list and include `<int>` results. As above, the tags MUST be
389-
in lexical order.
400+
is less than `<int>`. Otherwise, the response MUST include `<int>` results. When `n` is zero, this endpoint MUST return
401+
an empty list, and MUST NOT include a `Link` header. Without the `last` query parameter (described next), the list returned will
402+
start at the beginning of the list and include `<int>` results. As above, the tags MUST be in lexical order.
390403

391-
The `last` query parameter provides further means for limiting the number of tags. It is used exclusively in combination with the
404+
The `last` query parameter provides further means for limiting the number of tags. It is usually used in combination with the
392405
`n` parameter:
393406
`/v2/<name>/tags/list?n=<int>&last=<tagname>` <sup>[end-8b](#endpoints)</sup>
394407

@@ -397,6 +410,8 @@ the last tag. `<tagname>` MUST NOT be a numerical index, but rather it MUST be a
397410
up to `<int>` tags, beginning non-inclusively with `<tagname>`. That is to say, `<tagname>` will not be included in the
398411
results, but up to `<int>` tags *after* `<tagname>` will be returned. The tags MUST be in lexical order.
399412

413+
When using the `last` query parameter, the `n` parameter is OPTIONAL.
414+
400415
#### Content Management
401416
Content management refers to the deletion of blobs, tags, and manifests. Registries MAY implement deletion or they MAY
402417
disable it. Similarly, a registry MAY implement tag deletion, while others MAY allow deletion only by manifest.
@@ -486,15 +501,13 @@ The `code` field MUST be one of the following:
486501
| code-5 | `MANIFEST_BLOB_UNKNOWN` | blob unknown to registry |
487502
| code-6 | `MANIFEST_INVALID` | manifest invalid |
488503
| code-7 | `MANIFEST_UNKNOWN` | manifest unknown |
489-
| code-8 | `MANIFEST_UNVERIFIED` | manifest failed signature verification |
490-
| code-9 | `NAME_INVALID` | invalid repository name |
491-
| code-10 | `NAME_UNKNOWN` | repository name not known to registry |
492-
| code-11 | `SIZE_INVALID` | provided length did not match content length |
493-
| code-12 | `TAG_INVALID` | manifest tag did not match URI |
494-
| code-13 | `UNAUTHORIZED` | authentication required |
495-
| code-14 | `DENIED` | requested access to the resource is denied |
496-
| code-15 | `UNSUPPORTED` | the operation is unsupported |
497-
| code-16 | `TOOMANYREQUESTS` | too many requests |
504+
| code-8 | `NAME_INVALID` | invalid repository name |
505+
| code-9 | `NAME_UNKNOWN` | repository name not known to registry |
506+
| code-10 | `SIZE_INVALID` | provided length did not match content length |
507+
| code-12 | `UNAUTHORIZED` | authentication required |
508+
| code-13 | `DENIED` | requested access to the resource is denied |
509+
| code-14 | `UNSUPPORTED` | the operation is unsupported |
510+
| code-15 | `TOOMANYREQUESTS` | too many requests |
498511

499512
### Appendix
500513

@@ -506,3 +519,4 @@ The following is a list of documents referenced in this spec:
506519
| apdx-1 | [Details](./detail.md) | Historical document describing original API endpoints and requests in detail (warning: some of this information may be out-of-date or not yet implemented) |
507520
| apdx-2 | [OCI Image Spec - manifests](https://github.com/opencontainers/image-spec/blob/v1.0.1/manifest.md) | Description of manifests, defined by the OCI Image Spec |
508521
| apdx-3 | [OCI Image Spec - digests](https://github.com/opencontainers/image-spec/blob/v1.0.1/descriptor.md#digests) | Description of digests, defined by the OCI Image Spec |
522+
| apdx-4 | [OCI Image Spec - config](https://github.com/opencontainers/image-spec/blob/v1.0.1/config.md) | Description of configs, defined by the OCI Image Spec |

0 commit comments

Comments
 (0)