Skip to content

Commit ab2a57d

Browse files
authored
adding faq again to replace #189 (#221)
Signed-off-by: vsoch <[email protected]>
1 parent ecd72c3 commit ab2a57d

File tree

3 files changed

+76
-3
lines changed

3 files changed

+76
-3
lines changed

README.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,8 @@ The specification can be found [here](https://github.com/opencontainers/distribu
88

99
- [Code of Conduct][code-of-conduct]
1010
- [Releases](RELEASES.md)
11-
- [charter][charter]
11+
- [Charter][charter]
12+
- [Frequently Asked Questions](faq.md)
1213

1314
### Use Cases
1415

faq.md

Lines changed: 70 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,70 @@
1+
# Frequently Asked Questions
2+
3+
Before diving into the [specification](spec.md), you should consider the following frequently asked questions
4+
and ideas about the overall design of your registry.
5+
6+
**Q: How do I design my registry models for Blobs, Image Manifests, and Repositories?**
7+
8+
By way of specifying the name of the repository (`<name>`) for upload endpoints,
9+
this gives you freedom to design your registry in several ways:
10+
11+
- Having blobs linked 1:1 to a repository, and then referenced in Image Manifests only belonging to that repository (you wouldn't need to worry about blob sharing across repositories, and cleanup would be limited to ensuring the blob only isn't needed by the repository in question)
12+
- Having blobs linked to Image Manifests, which are linked to Repositories.
13+
- Having blobs not linked to any Image Manifest or Repository and shared amongst all blobs (and for this implementation idea you would need to ensure that blobs are not deleted that are still being used, and that there aren't any security loopholes with someone uploading a blob that would be used by another repository.
14+
15+
If there is another design idea not listed, please contribute it to the specification. For all of the above designs, you should consider storage (organization), along with permissions and cleanup. Different registries with varying user groups will likely have different use cases that warrant different behavior.
16+
17+
**Q: How do I handle garbage collection?**
18+
19+
Based on the design you choose above, you might want to implement integrity checking. For example, when you upload a manifest all blobs that it references should already exist in your registry.
20+
21+
**Q: How do I store the manifest?**
22+
23+
It's typically easiest to store the manifest as the raw byte stream that was originally provided. If you want to do additional parsing of content (e.g. to derive layers or annotations) that can be done as well.
24+
25+
**Q: What about annotations in manifests?**
26+
27+
While the specification does not say anything about annotations, you might choose
28+
to parse a manifest and represent them in a model, for easy query. It's up to you
29+
how you want to design an Annotation table. For example, since annotations could contain
30+
secrets you might want to keep them within the scope of an image or repository.
31+
32+
**Q: What kind of digest are we talking about?**
33+
34+
For these push endpoints and generally all distribution specification mentions of blobs, we are generally refering to a sha256 digest, however [other types](https://github.com/opencontainers/image-spec/blob/master/descriptor.md#digests) could be supported.
35+
36+
**Q: Can I change the upload location?**
37+
38+
For a chunked upload, you could implement it so that each PATCH request uses the
39+
same `<location>`, but you could also generate new session ids for scoped uploads.
40+
This decision is up to you. Expiring and then generating a new `<location>` could better match specific chunks to upload sessions, but a single `<location>` shared across chunks could better support more parallel operations (if your registry can support this).
41+
42+
**Q: Should I validate the content type of the patch request body?**
43+
44+
The content type for blob uploads isn't meaningful since it's consistently the same (application/octet-stream).
45+
However, you may so choose to check that the content type is consistent for each chunk in the upload.
46+
It would not be logical for it to change part of the way through.
47+
48+
**Q: Is there a suggested chunk size, or number of chunks?**
49+
50+
There is currently no best practice for an upload size or number of chunks.
51+
52+
**Q: What is the order of a push for some client?**
53+
54+
Generally, the data dependency between components drives the order of operations.
55+
For example, you can't upload a mainfest without knowing the config blob and layer digests. You can't know the config blob digest without knowing the layer diffids. You can't know the layer digests until you've gzipped and uploaded them (unless you know them ahead of time). This generally means that we do an upload like:
56+
57+
- blobs are uploaded first (config and layers)
58+
- blobs (optionally) are then linked to an image manifest (and the manifest uploaded)
59+
- the layers and manifest are linked to a repository
60+
61+
Keep in mind that along with image layers, the config is a [separate blob](https://github.com/opencontainers/image-spec/blob/master/config.md#example) that describes the container runtime specification.
62+
63+
**Q: Can the location session for a push expire?**
64+
65+
While there is no detail in the specification about the session expiring, you could
66+
choose to expire it after, for example, a minute or an hour, in the case that you don't want an upload session to be re-used. If you choose to expire sessions, you should test this expiration time to ensure that it works for different kinds of network connectivity for your user base.
67+
68+
**Q: What happens if the `<tagname>` (last) parameter does not exist?**
69+
70+
There is no suggested behavior in the specification for what to do if the tag does not exist. Registries might consider ignoring te parameter, or assuming a non-existing tag is at the start or the end of the sorted list. In the first case, at the start of the list would imply returning the entire set of tags. In the second cast, at the end of the list would imply returningan empty list, as it references the last tag onward (an empty set).

spec.md

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -183,6 +183,7 @@ If the blob or manifest is not found in the registry, the response code MUST be
183183
Pushing an artifact typically works in the opposite order as a pull: the blobs making up the artifact are uploaded first,
184184
and the manifest last. Strictly speaking, content can be uploaded to the registry in any order, but a registry MAY reject
185185
a manifest if it references blobs that are not yet uploaded, resulting in a `BLOB_UNKNOWN` error <sup>[code-1](#error-codes)</sup>.
186+
A useful diagram is provided [here](https://github.com/google/go-containerregistry/tree/d7f8d06c87ed209507dd5f2d723267fe35b38a9f/pkg/v1/remote#anatomy-of-an-image-upload).
186187

187188
##### Pushing blobs
188189

@@ -217,7 +218,8 @@ Successful completion of the request MUST return either a `201 Created` or a `20
217218
Location: <blob-location>
218219
```
219220

220-
Here, `<blob-location>` is a pullable blob URL.
221+
Here, `<blob-location>` is a pullable blob URL. This location does not necessarily have to be served by your register, for example, in the case of a signed URL from
222+
some cloud storage provider that your registry generates.
221223

222224
---
223225

@@ -235,7 +237,7 @@ Here, `<name>` refers to the namespace of the repository. Upon success, the resp
235237
Location: <location>
236238
```
237239

238-
The `<location>` MUST contain a UUID representing a unique session ID for the upload to follow.
240+
The `<location>` MUST contain a UUID representing a unique session ID for the upload to follow. The `<location>` does not necessarily need to be provided by the registry itself. In fact, offloading to another server can be a [better strategy](https://www.backblaze.com/blog/design-thinking-b2-apis-the-hidden-costs-of-s3-compatibility/).
239241

240242
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,
241243
see [RFC 7231](https://tools.ietf.org/html/rfc7231#section-7.1.2).

0 commit comments

Comments
 (0)