forked from opencontainers/image-spec
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
canonicalization: Add recommendations for canonicalization
Spun off from [1], now that we seem to have reached a consensus for "SHOULD canonical JSON" there. I've set this up so we have space to add canonicalization recommendations for other formats, although the only other basic type discussed in this repository is a gzipped tarball and that's more than I want to bite off at the moment ;). [1]: opencontainers#259 Subject: manifest json fields order Signed-off-by: W. Trevor King <wking@tremily.us>
- Loading branch information
Showing
3 changed files
with
24 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
# Canonicalization | ||
|
||
OCI Images [are](descriptor.md) [content-addressable](image-layout.md). | ||
One benefit of content-addressable storage is easy deduplication. | ||
Many images might depend on a particular [layer](layer.md), but there will only be one blob in the [store](image-layout.md). | ||
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. | ||
To allow efficient storage, implementations serializing content for blobs SHOULD use a canonical serialization. | ||
This increases the chance that different implementations can push the same semantic content to the store without creating redundant blobs. | ||
|
||
## JSON | ||
|
||
[JSON][] content SHOULD be serialized as [canonical JSON][canonical-json]. | ||
Of the [OCI Image Format Specification media types](media-types.md), all the types ending in `+json` contain JSON content. | ||
Implementations: | ||
|
||
* [Go][]: [github.com/docker/go][], which claims to implement [canonical JSON][canonical-json] except for Unicode normalization. | ||
|
||
[canonical-json]: http://wiki.laptop.org/go/Canonical_JSON | ||
[github.com/docker/go]: https://github.com/docker/go/ | ||
[Go]: https://golang.org/ | ||
[JSON]: http://json.org/ |