Skip to content

Add container image import to create an image from a rootfs tarball#1772

Open
muk2 wants to merge 1 commit into
apple:mainfrom
muk2:feat/426-import-filesystem-from-tarball
Open

Add container image import to create an image from a rootfs tarball#1772
muk2 wants to merge 1 commit into
apple:mainfrom
muk2:feat/426-import-filesystem-from-tarball

Conversation

@muk2

@muk2 muk2 commented Jun 20, 2026

Copy link
Copy Markdown

Summary

Adds container image import <tarball> <reference> — the analog of
docker import — which builds a single-layer OCI image from a root filesystem
tarball (.tar or .tar.gz, compression auto-detected). The resulting image is
tagged with the given reference and can be run like any other image.

Testing

  • make check passes (formatting + license headers).
  • Unit tests: new ImageImporterTests verify that the importer produces a
    well-formed index -> manifest -> config -> single layer with a sha256: diffID.
    Passes.
  • Manual: tar -cf rootfs.tar -C rootfs . then
    container image import rootfs.tar myimg:latest; the image appears in
    container image ls and container run --rm myimg:latest cat /hello.txt
    prints the expected file contents.

Fixes #426

Implements a new `container image import <tarball> <reference>` subcommand,
analogous to `docker import`. The input archive (plain `.tar` or a compressed
`.tar.gz`/`.tar.zst`/...) is treated as a single image layer: it is extracted,
re-archived into a canonical uncompressed tar (to compute the layer diffID) and
a gzip-compressed tar (the layer blob), and a minimal OCI config, manifest, and
index are synthesized and written to the content store before registering the
image reference in the image store.

The layer-building core lives in `ImageImporter` and is exercised by a unit
test in the new `ContainerImagesServiceTests` target.

Fixes apple#426
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Request]: Import filesystem from tarball

1 participant