DockerRootfsBuilder when you want a Dockerfile to be the source of truth for a custom SmolVM image. It builds a raw ext4 root filesystem, caches it by build inputs, and returns a BootImage.
Constructor
Cache directory name. Letters, numbers,
., _, and - are allowed.Dockerfile text. Blank Dockerfiles are rejected.
Files to copy into the temporary Docker build context. Keys must be safe relative paths.
Size of the generated raw ext4 root filesystem. Must be greater than
0.Cache root for built custom images.
Extra JSON-serializable values mixed into the cache key.
Docker build arguments passed as
--build-arg.Docker target platform override. When omitted, SmolVM selects
linux/amd64 or linux/arm64 from the requested architecture.Whether the image starts SSH and accepts the credentials you pass to SmolVM.
ensure
Backend to prepare the image for. Public docs focus on
"firecracker" and "qemu".Guest architecture. Use
"host" to match the current machine.Boot profile to render later for the selected backend.
Explicit kernel boot arguments. Mutually exclusive with
boot.A
BootImage with rootfs_format="raw-ext4", the built rootfs path, the matching SmolVM base kernel, backend, arch, and ssh_capable flag.Cache behavior
The cache key includes the Dockerfile, build context, build args, target architecture, rootfs size, Docker platform, andfingerprint_inputs. It does not include the backend or kernel identity, so Firecracker and QEMU can reuse the same rootfs when the architecture matches.
Context safety
DockerRootfsBuilder validates context paths before running Docker:
- Context keys must be relative paths.
..traversal is rejected.- A context entry named
Dockerfileis reserved. - Missing files passed as
Pathvalues raise an error before the build starts.
