In the last post on Velarx I gave an overview of the engine and ran a few benchmarks against Podman. Here I want to look at how the storage layer is put together. The design comes down to a few simple boundaries: untrusted fetchers bring bytes into staging over varlink, the engine verifies every file and builds the layer images itself, a storage backend (either the built-in composefs driver or an external process over varlink) stores those verified files and returns detached lower mounts, and an fs-verity chain of trust runs from the image signature down to the pages the kernel reads.
Posts for: #Containers
Velarx: a container engine with a chain of trust
For the last few weeks I’ve been working on Velarx, a container engine written in Rust that is built around composefs from the start. I used AI heavily to prototype it, otherwise in a few weeks I wouldn’t have gotten to something that runs real images and that I could compare with Podman. Like composefs, it stores every file by its fs-verity digest. The name comes from the Latin velox, swift, and arx, citadel, and those are the two goals: it has to be fast, and what it runs must be verified from the image signature down to every page the kernel reads.
Why CAP_SYS_PTRACE is worse than CAP_SYS_ADMIN
I spend a lot of time working on crun and on how containers are kept
separated from the host. Capabilities are one of the tools we use for
that: instead of giving a container the full power of root, we hand out
only the small pieces it needs. CAP_SYS_ADMIN gets most of the
attention, since it is so powerful that people call it the new root, and
dropping it is often treated as enough to make a container safe. I want
to look at another capability that doesn’t sound so dangerous:
CAP_SYS_PTRACE.
Sharing EROFS superblocks across container mounts
For a while now we’ve had composefs support in the container-libs. For each OCI layer in an image, we build a read-only EROFS blob that can be verified with fs-verity and that the kernel mounts directly. It works well if you look at a single container, but the moment you start thinking about composefs as the storage for a real container host where many containers are running, we have a problem. Many of them share the same image layers but with composefs every one of those containers mounts the same EROFS blobs, and each mount is a separate world as far as the kernel is concerned. The bytes on disk are shared, but the memory used to cache them is not. That is one of the reasons composefs is not yet the default way to store and run containers, and it is what I want to talk about here.
Locking composefs images with flock
For the last couple of weeks, I’ve been working on garbage collection
for composefs repositories. A composefs repository is a
content-addressed object store, and it needs a garbage collector to
reclaim space from images that are no longer referenced. The hard part
is deciding what “referenced” actually means when an image has no ref
in the repository but is mounted somewhere, possibly from another
process, possibly in a different mount namespace, possibly by the
running system itself. On
composefs-rs#346
was suggested to use flock() on the EROFS backing file. Mounters
take a shared lock, the GC probes with an exclusive one, and if the
exclusive lock fails, the image is still in use.
Composefs - a file system for container images
For the last couple of weeks, I’ve been playing on a PoC implementation of a file system for the Linux kernel. The goal is to address a fundamental limitation in how container images are stored: the existing overlay model deduplicates at the layer level, but once you want per-file deduplication — so that identical files across different images share a single copy on disk and in the page cache — the current architecture gets in the way and requires awkward workarounds involving hard links or filesystem-specific reflinks.
Crun moved to github.com/containers
The giuseppe/crun github project was moved under https://github.com/containers/crun. Moving to the containers organization means the project is no longer a personal experiment but a community-maintained component of the container stack, alongside tools like Podman, Buildah, and fuse-overlayfs. This makes it easier to coordinate changes across the ecosystem and signals that crun is a supported alternative OCI runtime for production use.
Similarly libocispec, used internally by crun for parsing the OCI configuration file was moved to https://github.com/containers/libocispec