VMs, Linux boxes, and OCI for an AI coding devbox
Introduction
An AI coding devbox is not just a folder with dependencies. When a model runs shell commands, edits files, and uses the network, the environment is part of security and reliability: what can escape, what you can discard, and whether the next teammate or CI run gets the same toolchain.
This post stays at the workspace layer: how Open Container Initiative (OCI) artifacts relate to Lima (Linux virtual machines with sharing and forwarding), LXC (Linux system containers on the host kernel), and Firecracker (KVM microVMs for strong isolation), and what runs where for a devbox around agents.
Companion pieces with more detail: Lima: Linux VMs with shared folders…, Firecracker microVMs: KVM isolation, and Lima VMs vs Firecracker microVMs. For a concrete golden-disk / disposable-clone Lima recipe (SSH agent forwarding, mode: data secrets), see dev-ore devbox.
Start with a portable definition of “this project”
Devbox flows usually assume an immutable-ish root filesystem plus a little mutable state (checkouts, caches). Under the OCI org, image-spec defines the image format; runtime-spec defines running an unpacked filesystem bundle; runc is the reference CLI that spawns containers on Linux per that runtime spec. distribution-spec standardizes registry push/pull. Together they support the familiar “build an image, run it elsewhere” contract without tying you to one vendor.
For AI-assisted work:
- Agents and editors often speak “image + mount + command” whether or not you call it Dev Containers.
- Reviews improve when installs and language versions live in layer history, not lost shell history.
- Rollback is “pin to digest
sha256:…” instead of guessing what changed on the host.
OCI standardizes image format, bundle layout, and runtime lifecycle—not which kernel or hypervisor you use. The sections below pick where that bundle runs.
Desktop pattern: a Linux VM as the devbox (Lima)
Lima launches Linux virtual machines with automatic file sharing and port forwarding (the README compares this to WSL2). The stated initial goal was promoting containerd and nerdctl on Mac; the same project documents Docker, Podman, Kubernetes, non-container workloads, and non-macOS hosts (e.g. Linux, NetBSD). Templates and docs sit on lima-vm.io.
AI angle: point the agent’s shell and container APIs at the Lima guest so installs and daemon sockets stay inside the VM. You pay RAM, disk, and boot cost for kernel separation from the host and fewer “wrong kernel on the laptop” surprises.
Copylimactl start lima uname -a
Linux host pattern: system containers without another kernel (LXC)
On a machine that is already Linux, when you want an environment close to a VM but without a separate kernel or hardware simulation, LXC targets system containers: namespaces, mandatory access control, and cgroups, per the README. Incus is the container hypervisor called out there as using LXC as its default runtime with a REST API.
AI angle: LXC fits “one devbox per project” on a shared Linux box when nested KVM is awkward or unnecessary. You give up guest kernel choice; you keep lower overhead and faster churn than full VMs. Security detail: linuxcontainers.org/lxc/security/ (linked from the LXC README).
Untrusted or multi-tenant execution: microVMs (Firecracker)
Firecracker is a VMM whose stated mission is secure, multi-tenant, minimal-overhead execution of container and function workloads. It uses Linux KVM to run microVMs: hardware-backed isolation with a minimal device set, aimed at serverless-style models while keeping startup and footprint small. The README documents an OpenAPI-described API, seccomp filters, a jailer for production-style launches, and integrations such as Kata Containers and Flintlock. Project site (linked from the README): firecracker-microvm.github.io.
AI angle: individuals rarely hand-curate Firecracker like a daily Lima VM; you care when remote sandboxes, CI, or hosted runners need hypervisor-grade isolation, not “namespaces only.”
Stitching it together without over-engineering
- Define the workload in OCI-shaped artifacts (opencontainers) so the definition travels (image + bundle + registry as needed).
- On macOS or whenever you need a Linux VM with sharing/forwarding, Lima is the common local path to a full Linux kernel for container tooling.
- On bare Linux, prefer ordinary OCI/runc-style containers first; step up to LXC when you want system-container semantics without paying for another kernel.
- Untrusted code or multi-tenant surfaces: assume Firecracker-class microVMs (often via a platform) rather than stretching namespaces into a hypervisor role.
This does not replace secret handling, diff review, or egress policy; it picks which ring those controls wrap.
Conclusion
Treat the AI coding devbox as a declared environment plus a chosen kernel boundary. OCI supplies the portable image, bundle, and runtime contract (and registry protocol); Lima lands Linux workloads in a VM with sharing and forwarding; LXC is the system-container path on Linux when sharing the host kernel is acceptable; Firecracker is the microVM tier when isolation goals match its multi-tenant, minimal-overhead design. Use the lightest option that matches trust and whether you need your own kernel.
That boundary is orthogonal to how prompts and shells are hosted: a minimal CLI harness, YAML workflow graphs, schema-first env discipline, macOS multiplexed agent panes, or a GUI AI terminal on whatever ring you chose here.