hauler-dev / hauler

Airgap Container Swiss Army Knife
https://hauler.dev
Apache License 2.0
127 stars 30 forks source link

[feature] support `docker load` semantics for hauler bundles #276

Closed dweomer closed 1 month ago

dweomer commented 3 months ago

Is this RFE related to an Existing Problem? If so, please describe:

RKE2 assumes a manifest.json at the top level of the tarball for the rke2-runtime image via rancher/wharfie. For all other images, RKE2 (and k3s) seem to have no issue importing our oci-layout tarballs. We could lobby to have wharfie be more accepting but I think it behooves us to render a manifest.json at the top of our hauler store, which is in oci-layout, which will enable /var/lib/rancher/rke2/agent/images drop-ins straight from hauler for the RKE2 bootstrap image (rke2-runtime). Moreover, this should enable docker load of uncompressed hauler tarballs.

Describe Proposed Solution(s):

Render entries in ${hauler-store}/manifest.json for every platform of every container image in the store, aka, "name", "config", "layer(s)". For example, here is the manifest.json created by ctr image export for the RKE2 v1.28.11+rke2r1 rancher/rke2-runtime image for the linux/amd64 platform:

[
  {
    "Config": "blobs/sha256/6fcb0bf266887eaeaf3c3fa09d28a760b694c82ecf0382fd6e3becbe3ef1abf6",
    "RepoTags": [
      "rancher/rke2-runtime:v1.28.11-rke2r1"
    ],
    "Layers": [
      "blobs/sha256/9985469ebb41c51e0d1c59c8dfccaefc225b6615d911da001c9734d6e17b4014"
    ]
  }
]

Describe Possible Alternatives:

Additional Context:

It should be pretty easy to validate that our solution is working correctly, and hence will work within RKE2, by running wharfie in docker container with network=none, e.g.:

# where ./images/ is a directory containing the hauler tarball containing `rancher/rke2-runtime` content
docker run --rm -it --network=none -v ./images:/images dweomer/wharfie:v0.6.6-amd64 --images-dir /images rancher/rke2-runtime:v1.28.11-rke2r1 /root

But also, too:

docker image load haul.tar # after uncompressing via zstd -d
zackbradys commented 2 months ago

Hey @dweomer, are you still intending to submit a PR for this for v1.1.0?

zackbradys commented 2 months ago

Hey @dweomer, checking back on the status of this!