Skip to content

[Request]: Allow a default runtime handler and per-machine runtime selection #2549

Open

Description

@RobertDeRose

Feature or enhancement request details

Runtime plugins other than container-runtime-linux can only be selected per container with
container run/create --runtime. There is no way to make one the default, and container machines
always boot with the built-in runtime: MachineConfiguration has no runtime field, and neither
container machine create nor container machine set accepts one.

This matters for third-party runtime plugins (for example a libkrun-based runtime that returns freed
guest memory to macOS) and for tools that create containers or boot machines on the user's behalf,
such as a compose plugin that runs its workload in a container machine. Those tools can't use another
runtime unless every invocation passes the flag, and for machines there is no flag at all.

Proposed approach

  • A [container] runtime system property (unset by default) used when no runtime is given.
    Unset keeps today's behavior (container-runtime-<os>).
  • An optional per-machine runtime setting stored with the machine's boot config:
    container machine create --runtime <name> and container machine set runtime=<name>
    (runtime= clears it).
  • The machine service resolves the runtime when it builds the machine's container config at boot.
  • Precedence:
    • containers: --runtime > [container] runtime > container-runtime-<os>
    • machines: machine runtime > [container] runtime > container-runtime-linux
  • An unknown runtime fails before anything is created, with an error naming where the value came
    from.

I have an implementation of this approach with unit tests and docs, and I'm happy to open a PR or
adjust the design (for example separate container and machine defaults) based on maintainer
feedback.

Code of Conduct

  • I agree to follow this project's Code of Conduct

Activity

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