logoalt Hacker News

XYen0ntoday at 6:25 PM2 repliesview on HN

The OCI manifest references the hashes of these compressed layers, and re-compressing them does not guarantee obtaining the same hash


Replies

mort96today at 7:43 PM

If that's the purpose, couldn't you store the hash and throw away the compressed image?

(As others said, compression is deterministic for the same algorithm, parameters and input data)

show 2 replies
flakestoday at 6:52 PM

Recompressing should be guaranteed deterministic. It’s the packing/unpacking of tar archives to/from directories on disk that leads to the non-determinism (such as timestamps and ownership metadata). If the tar is left intact, both zstd and gzip should produce byte for byte identical outputs given the same compression parameters.

show 2 replies