Record the source URI of imported images at /.enroot/source#267
Open
alec-flowers wants to merge 1 commit intoNVIDIA:mainfrom
Open
Record the source URI of imported images at /.enroot/source#267alec-flowers wants to merge 1 commit intoNVIDIA:mainfrom
alec-flowers wants to merge 1 commit intoNVIDIA:mainfrom
Conversation
enroot import docker://... and enroot load now write a small provenance file inside the image rootfs recording the URI and manifest digest. The URI is captured as provided to enroot, with any USER@ credential component stripped. dockerd:// and podman:// imports record the URI only (no registry digest available). The file can be read with unsquashfs -cat image.sqsh .enroot/source or, once the image is unpacked, from inside a running container. No new CLI, no runtime.sh changes: enroot export already strips /.enroot/ which is correct behavior here, since a rootfs modified and re-exported is no longer the image at the original URI. Signed-off-by: Alec Flowers <aflowers@nvidia.com>
Author
End-to-end test outputTested against 1.
|
This file contains hidden or 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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
enroot import docker://...andenroot loadnow drop a tiny provenancefile inside the imported image at
/.enroot/source:This answers the recurring question "where did this
.sqshcome from?"— a question that's currently unanswerable once an imported image has
been copied between hosts or handed off to someone else, since enroot
keeps no trace of the source URI in the image itself.
Motivation
For reproducibility work around benchmark pipelines, we want to be able
to look at a squashfs on disk and know which registry image produced it.
enroot digest(added indba4f81) helps before import, but onceimported there's no link back to the source. External sidecar metadata
works until the file gets renamed or moved.
This puts the provenance inside the image itself, so it travels with
the
.sqsh.Design notes
/.enroot/source: uses the existing enroot-owned namespace(
runtime.sh:25 bundle_dir="/.enroot"), which is already bind-mountedread-only at runtime so a container can't tamper with its own
provenance record. No collision risk with guest OS files in
/etc/.key=valuelines, shell-parseable, trivial to readwith
unsquashfs -cat image.sqsh .enroot/sourceor from inside arunning container.
USER@is removed using the user alreadyparsed by
docker::_parse_uri, so theIMAGE@DIGESTshorthand(e.g.
docker://ubuntu@sha256:...) isn't mis-handled.HEADon the manifestURL, same pattern as
docker::digest. Empty (key omitted) fordockerd:///podman://since there is no registry manifest.enroot exportintentionally strips/.enroot/, which is correcthere: a rootfs that was
created, modified, and re-exported is nolonger the image at the original URI, so dropping the field avoids
lying. No changes to
runtime.shneeded.unsquashfs -catis sufficient; if demand warrants,a wrapper command can be added later.
Diff size
50 insertions / 12 deletions across
src/docker.shanddoc/image-format.md.Test plan
bash -n src/docker.shdocker::_sanitize_uriacross the URI shapesaccepted by
docker::_parse_uri(with and withoutUSER@,with and without
@DIGEST,IMAGE@DIGESTshorthand,dockerd://,podman://).enroot import docker://ubuntu:22.04→unsquashfs -cat ubuntu+22.04.sqsh .enroot/sourceshows URIand digest.
enroot import docker://user@registry/image:tagwith credentialsin
.credentials→ recorded URI has nouser@.enroot import dockerd://local-image:tag→ URI-only record,no
digest=line.End-to-end validation against
enroot 4.1.2onx86_64— see commentbelow for the verbatim output.
Happy to iterate on the file location, key names, or scope (e.g. add
arch=,imported_at=) if preferred.