Skip to content
This repository was archived by the owner on Jun 3, 2026. It is now read-only.
This repository was archived by the owner on Jun 3, 2026. It is now read-only.

Add podman run --bootc-vm or so #99

Closed

Description

@cgwalters

Moving this from #95 (comment)

We had a thought a while ago that the functionality from podman-bootc might move to podman. However that has a large scope.

But what would have a much smaller and more obvious scope/match is moving just this functionality to podman:

Run a container that has a kernel embedded (in /usr/lib/modules) as a VM via direct boot (no bootloader) using the container's rootfs via virtiofs. The tool should support overriding init or just leave it with the default (which should work with systemd)

Strawman: podman run --bootc-vm <image>

cc @alicefr

Maybe it shouldn't be --bootc-vm but a more generic name; again the key idea is that we're running the kernel from the target image, and we're also just default to the commandline from the target image (e.g. systemd) - unlike e.g. kata we wouldn't have a runtime embedded.

Details

A really key question is whether the result of the execution of this should itself be represented as a podman container. This question is entangled with questions that arose in the original issue of whether we should require a virt stack on the host (as podman machine does) or whether it should come from a container.

If it does not appear as a (podman) container then perhaps it shouldn't be under podman run, but something more like podman machine runc or so?

Activity

  1. cgwalters commented on Aug 19, 2025

    @cgwalters
    MemberAuthor

    This would force a bit of generalization of podman's virtualization abstraction that is right now only used by podman-machine, but I think it makes sense.

  2. cgwalters commented on Aug 19, 2025

    @cgwalters
    MemberAuthor

    (A detail that would make everything a lot more streamlined here is if we changed podman-machine (at least on Linux) to always run this way - instead of fetching disk images as OCI artifacts, we just fetch a bootc container! Only specific directories would persist (such as /var/lib/containers); those directories could persist on the host or in attached volumes. That'd be a huge change of course though)

  3. alicefr commented on Aug 21, 2025

    @alicefr

    @cgwalters is there a place where this should be broadly discussed?Any community meetings? Bootc meeting perhaps?

  4. cgwalters commented on Aug 21, 2025

    @cgwalters
    MemberAuthor

    For both podman and bootc there are community meetings for sure. Bootc's are listed at https://github.com/bootc-dev/bootc?tab=readme-ov-file#community-discussion and podman's at https://podman.io/community

    That said let's gather some initial thoughts from maintainers here cc @baude


    In the short term though what would probably make sense is to just implement this core functionality as podman-bootc run-ephemeral or so here (and then we'd be able to use it for doing a persistent install).

  5. ericcurtin commented on Aug 26, 2025

    @ericcurtin

    I think one of the tricky parts here is macOS... But still doable as part of podman remote there

  6. cgwalters commented on Aug 26, 2025

    @cgwalters
    MemberAuthor

    I think one of the tricky parts here is macOS...

    Yes it's hugely tricky in this case where the container files live inside the podman-machine VM. We don't want to do a copy - what we want is for a virtiofs mount for one VM to be backed by files stored in another. I don't think that's possible using the high level Virtualization API which just exposes the ability to mount host volumes. I guess it doesn't have to be a virtiofs mount, we could mount via e.g. NFS (over vsock e.g.) or so.

  7. Luap99 commented on Aug 26, 2025

    @Luap99

    I didn't read carefully the history but my initial thought process is that if you like to run any bootc image as VM this sounds to me more like like a new "runtime", e.g. there is --runtime krun currently to run an image as a VM via libkrun. That AFAIK is implemented via extension/plugin in crun. There is also https://github.com/containers/crun-vm/.

    So I think you could have something like podman --runtime bootc run <bootc-image> design wise rather easily and the the details get abstracted in the external runtime. That would avoid the need for podman changes I guess.
    cc @mheon @baude

  8. baude commented on Aug 26, 2025

    @baude

    First, I think getting time at a Podman community meeting or cabal would be an appropriate forum. You would have most of the Podman maintainers available. I like this idea and topic and I am encouraged by it. I also see some possible benefits to Podman's workflow. Here are some of my additional thoughts:

    • Paul is onto something but I would offer that we should have a default approach that just works and requires no extra knowledge.
    • It makes sense somewhere in the podman machine subcommand context, though exactly where and how would be good design conversations.
    • I am currently writing a Podman 6 HLD and will open this up for review very soon. Podman 6 is due in Spring of 2026. If we want this to be part of Podman 6, we need to get cracking to understand scope.
  9. cgwalters commented on Aug 26, 2025

    @cgwalters
    MemberAuthor

    I didn't read carefully the history but my initial thought process is that if you like to run any bootc image as VM this sounds to me more like like a new "runtime", e.g. there is --runtime krun currently to run an image as a VM via libkrun. That AFAIK is implemented via extension/plugin in crun. There is also https://github.com/containers/crun-vm/.

    Yes, I commented the same in #95 (comment)

    I didn't read carefully the history but my initial thought process is that if you like to run any bootc image as VM this sounds to me more like like a new "runtime", e.g. there is --runtime krun currently to run an image as a VM via libkrun.

    Right, and one of those details is that krun currently uses its own kernel, not the kernel from the image. That's possible to change of course with a different variant. I'll investigate krun a bit more again.

    (From a quick glance at the source, is the status quo with podman-machine that it only does krun on MacOS, not Linux?)


    I keep wavering a bit on whether we actually want this thing to be via podman run with all that implies - basically in showing up as a pod. Sometimes I might want that, other times not; at least the core low level primitive should work without being represented necessarily as a pod/container. (This topic of course gets to the interesting one that on Linux one could imagine that the podman-machine VM actually showed up as a visible pod when using the default connection...would that be useful? Maybe? There's similar implications for the use cases of this outside of podman machine)

  10. baude commented on Aug 26, 2025

    @baude

    (From a quick glance at the source, is the status quo with podman-machine that it only does krun on MacOS, not Linux?)

    Correct, we use libkrun only on Apple Silicon Macs.

  11. alicefr commented on Aug 27, 2025

    @alicefr

    hi everyone, this discussion move in a different direction then what we have discussed #95. What the original PR covers is deploying an ephemeral rootless VM where we can build bootc images using podman from inside the VM to use all the privileged option and to be able to operate at disk level.

    It relies on libvirt, so not calling directly QEMU, or libkrun. But for the rest it looks very close to what podman machine does.

    In the original PR, the virt stack is deployed entirely in a container created by rootless podman, and then the bootc container is spawn inside the VM. The other options we were discussing in instead of having libvirt inside the container, to rely on libvirt from the host. My main question here is which one of the alternatives are the more desirable.

    As Colin already mentioned, the goal is to boot from the artifacts from the bootc image.

    IMO, a new runtime isn't necessary, since we aren't trying to launch containers, but only to create an ad-hoc environment for the bootc builds.

  12. added a commit that references this issue on Aug 30, 2025
  13. cgwalters commented on Aug 30, 2025

    @cgwalters
    MemberAuthor

    OK I really wanted to have this so I decided to spend a bit of time on it myself just to understand things better. There's a ~working PoC level result here: bootc-dev/bcvk@ad5aaeb

    A key way this works is basically via a podman run that mounts the host /usr in (so we have access to the virt stack from there), and just runs in the context of the target container image. Though note we also mount the target image again at /run/source-image so what we see is the pristine source image that we export via virtiofsd.

    In this case it's important to understand that qemu and virtiofsd binaries come from the host, but everything is lifecycle bound to the container image (so yes, closer to crunvm...arguably we could put this there).

    This is a really tiny amount of code in the end; yeah it's in Rust because well it's me writing it but eh, we can easily carry a Go implementation of this too.

  14. added a commit that references this issue on Aug 30, 2025
  15. cgwalters commented on Aug 30, 2025

    @cgwalters
    MemberAuthor

    (Very tangential note but it took me a LOT of head scratching to figure out that in order to do nested containers that mount their own /proc I needed --security-opt=unmask=/proc/*)

  16. cgwalters commented on Sep 5, 2025

    @cgwalters
    MemberAuthor

    (Very tangential note but it took me a LOT of head scratching to figure out that in order to do nested containers that mount their own /proc I needed --security-opt=unmask=/proc/*)

    Ah https://lore.kernel.org/linux-fsdevel/[email protected]/ touches on this...it's possible to work around apparently, but man the workaround is ugly.

  17. slp commented on Sep 10, 2025

    @slp

    Right, and one of those details is that krun currently uses its own kernel, not the kernel from the image. That's possible to change of course with a different variant. I'll investigate krun a bit more again.

    libkrun added supports for external kernels some months ago. https://github.com/containers/libkrun/blob/2012b7fd9798fd7056efd7a030daff2984af348b/include/libkrun.h#L706

    It's also going to have support for arbitrary FW/BIOS images later this month.

    crun is already capable of making use of this API to set a kernel/initramfs that's present in the OCI image as payload. We also plan to expand the configuration file with more options to set up devices (by the end of the month we'll support booting Android, which requires a very specific machine definition).

  18. cgwalters commented on Sep 10, 2025

    @cgwalters
    MemberAuthor

    libkrun added supports for external kernels some months ago. https://github.com/containers/libkrun/blob/2012b7fd9798fd7056efd7a030daff2984af348b/include/libkrun.h#L706

    Cool. Is anything using that?

    crun is already capable of making use of this API to set a kernel/initramfs that's present in the OCI image as payload

    You mean crun-vm, not crun right? And in theory it could be changed to do so, or it has code to do it now?

    What it's doing with bootc right now is super inefficient: https://github.com/containers/crun-vm/blob/986f695aab15743dd0fdfdba3007ad659bde7c3a/embed/bootc/prepare.sh#L91

    But obviously we can fix that using the same logic as is done here.

    I have some reservations about crun-vm in that I don't always want to bind vms to pods, and it feels a bit conceptually awkward to try to have every verb there try to map container runtime concepts; it's not the same as kata.

  19. slp commented on Sep 10, 2025

    @slp

    crun is already capable of making use of this API to set a kernel/initramfs that's present in the OCI image as payload

    You mean crun-vm, not crun right? And in theory it could be changed to do so, or it has code to do it now?

    Nope, actual crun: https://github.com/containers/crun/blob/6f0a3c5013e62c25f6eaa6e049aabc8b504d4e66/src/libcrun/handlers/krun.c#L99

  20. cgwalters commented on Sep 10, 2025

    @cgwalters
    MemberAuthor

    I think I knew at one point that crun linked to krun, but forgot about it. Obviously it's done so for years...but is anything using it? https://github.com/containers/crun/blob/main/crun.1.md#runocihandlerhandler classifies it as experimental.

    Anyways so yes obviously krun is doing the "virtiofs root of container" thing. Are you thinking we'd a flag to krun to auto-discover the kernel/initramfs from the target image? Otherwise we still need external tooling to at least orchestrate that.

    And I guess to me what's still super important here is to also streamline the bootc install to-disk flow (like crun-vm is trying and podman-bootc does too) which seems to be outside the obvious scope of "OCI runtime".

  21. germag commented on Sep 10, 2025

    @germag
    Collaborator

    I think I knew at one point that crun linked to krun, but forgot about it. Obviously it's done so for years...but is anything using it? https://github.com/containers/crun/blob/main/crun.1.md#runocihandlerhandler classifies it as experimental.

    Anyways so yes obviously krun is doing the "virtiofs root of container" thing. Are you thinking we'd a flag to krun to auto-discover the kernel/initramfs from the target image? Otherwise we still need external tooling to at least orchestrate that.

    I don't know if I mentioned in one our of our meetings, but I was experimenting with this. Didn't finish it, but my idea was to use the oci runtime spec config VM:

        "kernel": {
            "path": "/path/to/vmlinuz",
            "parameters": ["root=virtiofs:tag"],
            "initrd": "/path/to/initrd.img"
        }
    

    And I guess to me what's still super important here is to also streamline the bootc install to-disk flow (like crun-vm is trying and podman-bootc does too) which seems to be outside the obvious scope of "OCI runtime".

  22. cgwalters commented on Sep 19, 2025

    @cgwalters
    MemberAuthor

    OK https://github.com/cgwalters/bcvk now exists. I am planning for this to fully replace podman-bootc on Linux at least in the near term.

    It could still totally make sense to add the core "ephemeral" functionality more directly into podman, but at the same time there's IMO a big need for deeper integrations like libvirt and more, and that feels more outside of podman's scope.

    So...for now I think it's good to just keep as a separate tool.

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions