Repository metrics
- Stars
- (1,253 stars)
- PR merge metrics
- (No merged PRs in 30d)
Description
Currently an image hash is computed by creating a tar archive of manifest and rootfs and taking the hash of it. By default, tar includes files in the archive in the order they are returned by readdir(), which can differ between hosts/filesystems. By enforcing an ordering of the files in the tar archive, computing an image ID of an unpacked image will always give the same result.
Why is this useful?
This becomes very useful when someone wants to combine signed images with some sort of delta transport. What I mean by that is a server (possibly untrusted) that can compute and serve an image delta from image A to image B.
With that, a client that already has image A can get and verify image B by:
- Downloading A->B delta file
- Downloading detached image B signature
- Apply the delta on a copy of image A
- Run the reproducible tar and pipe it to
gpg --verify
How can this be done?
New versions of tar support a --sort=name option that does exactly that. The same thing can be accomplished in with an old tar by creating a sorted list of files and piping the list to tar with the --files-from=- option.
I propose enforcing this file ordering in the Image Archive spec so that every unpacked image maps to exactly one image ID.