weaveworks / ignite

Ignite a Firecracker microVM
https://ignite.readthedocs.org
Apache License 2.0
3.49k stars 224 forks source link

load container image from file #873

Open milahu opened 2 years ago

milahu commented 2 years ago

in docker we have docker load

docker load < some-container.tar.gz
docker run some-container:latest

how does this work with ignite?

milahu commented 2 years ago

the only workaround i see, is serving the image from a local registry, and calling

sudo ignite run localhost/my-image:1.0.0
darkowlzz commented 2 years ago

Hi, at the moment, ignite uses the container runtime's content store to import images. The default container runtime being containerd, when ignite pulls an image, the image is pulled into the containerd image store and then copied to /var/lib/firecracker/image/. Deleting an image from /var/lib/firecracker/image/ and pulling the same image, will just copy the same image from containerd image store. In order to load image from file, the image should be loaded into the container runtime, containerd or docker, and then imported by ignite. For containerd, you may try using ctr images import to load the image into containerd image store, similar to docker load. Since containerd is the default image store, ignite image import will copy the image from containerd automatically. To copy image from docker image store, ignite image import <image> --runtime docker will copy the image from docker.

When you use a local registry, it still pulls the image into the container runtime content store. If the image is already in the content store, it can be directly imported into ignite with ignite image import command. The same kind of command for kernel image import ignite kernel import.

Hope that's helpful.

darkowlzz commented 2 years ago

Looks like I did work on this feature a long time ago but didn't finish it, maybe because the image store may change to use the containerd content store directly https://github.com/weaveworks/ignite/pull/557.

cron410 commented 1 year ago

Is there a way to run the VM from a squashfs or ext4 rootfs image directly as Firecracker suggests? My goal is to run container images directly beside a firecracker VM that runs a custom OpenWRT with a custom kernel that enables MPTCP. Seems like placing that custom kernel inside a docker image is not difficult.