Run OCI images on Atlas: findings and plan
Result. Docker Hub images boot on Firecracker with no Docker and no container runtime in the guest. We unpack the image into an ext4 disk, add one small init program, and boot it with the Ubuntu kernel that Atlas already uses.
Recommendation. Follow the Fly.io model for the guest. Keep the Atlas storage path: an image becomes a normal Virtual Machine Image with an ext4 root file system. Then ZFS clones, object storage, and host caching work with no first-phase change to the Metal API.
Evidence. nginx from Docker Hub answered HTTP 200 over a TAP device about 840 ms after Firecracker started. A graceful stop, disk growth, and a restart with data also worked.
Limit. All tests ran on a laptop. Nothing ran on an Atlas host or through metald yet.
Why this needs more than an unpacked image
An OCI image is a list of file system layers and one small configuration file. A layer is a tar archive of changed files. The configuration gives the program to start, its environment, its user, and its working directory. Docker Hub stores images in this format.
An OCI image is not a bootable machine. It has no kernel and no init program. Init is the first process that the kernel starts. The image also does not know how to configure the Atlas network.
Today, each Atlas guest gets these jobs from Ubuntu: systemd, cloud-init, apply-metadata, and SSH. Many Docker Hub images have none of these. Some have no shell and no Python. Our init must do the jobs that an Atlas VM needs.
How other providers do it
| Provider | Isolation | Image to disk | Guest | Root disk after restart |
|---|---|---|---|---|
| Fly.io | Firecracker | containerd on each host is a cache. It unpacks images into devmapper thin snapshots. Each VM gets a copy-on-write device. Later, Fly added overlayfs with a writable upper layer. | Own Rust init. It reads run.json, mounts file systems, sets DNS, runs SSH, and starts the entrypoint. | Reset by default. persist_rootfs can keep it. Volumes hold durable data. |
| DigitalOcean MicroVMs | Firecracker | Takes an OCI reference with --oci-ref. The base disk is immutable, content-addressed, and loaded in chunks through ublk. Each execution has a local sparse overlay. The conversion step is not published. | Guest init is mentioned. Its design is not published. | Files survive a pause. Scratch data clears when the session ends. |
| Railway | Not published | We found no public description of its runtime. Its builder runs in microVMs. Its orchestrator is its own and is not Kubernetes. | Not published | Volumes hold durable data. |
| firecracker-containerd | Firecracker | containerd with a block snapshotter, such as devmapper. | Runs an agent and a container runtime in the guest. | Depends on the setup. |
What matters for Atlas. Fly needs containerd and devmapper to get thin copy-on-write disks on a host. Atlas already has this with a ZFS volume per image and a ZFS clone per VM. So Atlas does not need containerd.
The DigitalOcean warm path is under 200 ms at p50 in its internal tests. It starts from an existing checkpoint and warm caches, and it excludes first-time image import. Atlas warm images already use a similar idea. Lazy chunk loading is a separate, later project.
What we tested
We pulled nine images from Docker Hub with skopeo, flattened the layers, and applied whiteouts. A whiteout is a marker in a layer that deletes a file from a lower layer. Then we built ext4 with mkfs.ext4 -d, added a 2.8 MiB static Go init, and booted the disk.
| Image | Layers | Pull MiB | Files MiB | Pull s | Flatten s | mkfs s | Result | Port open* |
|---|---|---|---|---|---|---|---|---|
nginx:1.29-alpine | 8 | 25 | 68 | 7.4 | 0.4 | 0.5 | ran | 49 to 74 ms |
redis:8-alpine | 7 | 38 | 120 | 8.4 | 0.4 | 0.9 | ran | 163 ms |
postgres:17 | 14 | 154 | 451 | 23.0 | 1.6 | 1.5 | ran, first boot ran initdb | 862 ms |
mariadb:11 | not read | not read | 331 | 14.0 | 1.2 | 1.4 | failed, then ran after the fix below | 5147 ms |
hashicorp/http-echo:1.0 | 10 | 4 | 16 | 5.6 | 0.2 | 0.2 | ran as UID 65532. Its log reports the port. | not probed |
traefik:v3 | 4 | 53 | 189 | 9.7 | 0.5 | 1.8 | started. Stayed up. Port 8080 did not open. | none |
python:3.13-slim | 4 | 41 | 125 | 11.8 | 0.7 | 0.8 | Exit 0: no terminal input | n/a |
node:22-slim | not read | not read | 233 | 11.3 | 1.0 | 1.1 | Exit 0: no terminal input | n/a |
ubuntu:24.04 | 1 | 28 | 85 | 6.7 | 0.5 | 0.6 | Exit 0: bash with no terminal input | n/a |
The kernel reached init in about 0.86 s on every boot. This includes slow serial console output. The entrypoint started 6 to 16 ms after init. Flatten plus mkfs took less than 4 s for each image.
Second round: boot, network, stop, and restart
| Test | Result | State |
|---|---|---|
| HTTP from outside the guest to nginx | HTTP 200. First answer at 831, 837, and 843 ms from Firecracker start with quiet loglevel=0. 1059 ms in one run with full console output. | tested |
Init at /sbin/init, no init= | Booted on Alpine (nginx, the path was a symlink) and on Debian (postgres, /sbin links to usr/sbin). | tested |
| Grow ext4 online with an ioctl | nginx: 311 to 1270 MiB in 24 ms. postgres: 791 to 1799 MiB in 8 ms. No resize2fs in the guest. | tested |
| Ctrl+Alt+Del to the image stop signal | nginx got SIGQUIT and exited in 31 ms. postgres got SIGINT, logged a clean shutdown, and exited in 19 ms. Firecracker exited with 0. e2fsck found the disks clean. | tested |
| Restart with the same disk | postgres logged "Skipping initialization" on the second boot. Port open 143 ms after init. | tested |
| Guest memory in use, 1 s after port open | MemTotal minus MemAvailable: nginx 114 MiB, postgres 172 MiB on first boot and 136 MiB on second. A 1024 MiB VM reports 956 MiB total. | tested |
Findings that change the design
- Do not mount over image directories. Our first init mounted a tmpfs on
/run. This hid the/run/mysqlddirectory that the MariaDB image ships, and the entrypoint failed. We removed the mount and setMARIADB_ROOT_PASSWORD, and the server started. Init must match Docker here, even though Fly mounts/run. - The Ubuntu kernel ignores
ip=. The boot log saysUnknown kernel command line parameters "ip=...". Soeth0stayed down and our first network test got no answer. Today, Ubuntu guests get their address from a systemd-networkd file in the image. Init must set the address itself. It can read theip=value that Metal already sends from/proc/cmdline. The comment onbootArgumentsin Metal does not match this kernel. - An exit is a normal event.
ubuntu,python, andnodeexit at once with code 0, because they expect a terminal. Metal starts a stopped guest when its desired state is running, and a successful start gets no backoff. We read this in the code and did not run it on a host. So an exit that powers off the guest would become a boot loop. See decision 2. - Images are small, so disks can be small. Our test disks were 276 to 819 MiB. The Ubuntu base is a fixed 4 GiB. The VM disk grows from the image size, so init must grow the file system itself. Ubuntu does this with cloud-init today.
- Whiteouts are real.
postgresandmariadbeach had 2. A plain tar extraction would keep files that the image deleted. The converter must handle whiteouts, and opaque whiteouts too, though none appeared in this set. - Each entrypoint expects a different stop signal. nginx declares
SIGQUITand postgres declaresSIGINT. Metal stops a guest with Ctrl+Alt+Del. By default the Linux kernel reboots at once on this event. Init turns this off withLINUX_REBOOT_CMD_CAD_OFF, receivesSIGINT, and sends the image stop signal. This worked in the second round. - Kernel modules are large. The Ubuntu modules package is 166 MiB compressed. Ubuntu images install it so that Docker and BPF work in the guest. Start without it. An image that needs
modprobewill not get that module. - Docker Hub limits are low for a fleet. The docs give 100 pulls per 6 hours per IP for anonymous use, and 200 per 6 hours for a free account. The response headers we saw said
100;w=3600, so the docs and the headers differ. Docker also warns about abuse limits for platforms that pull for many users from one address. Pull each digest once. Do not pull once per host.
Approaches
Where does the image become a disk?
| Option | Good | Bad | View |
|---|---|---|---|
| A. Atlas background job | Smallest change. One pull for each digest. The result uses the current image path. | A tenant image would feed an untrusted archive to the control plane. Large images use Atlas worker disk. | Use first, for images an operator selects. |
| B. Metal host at first use (Fly style) | No object storage copy. Close to Fly. | Root daemon parses untrusted archives. Each host pulls, so rate limits apply. Two hosts can build different ext4 bytes, but Metal binds an image reference to one SHA-256. VM create waits for the conversion. | Reject. |
| C. Temporary builder VM | A hostile archive reaches only a guest. One pull for each digest. It can upload through the current signed multipart path. | More moving parts. Needs a builder image, a network, and job tracking. The warm image temporary VM has no network, so it cannot be reused as it is. | Use for tenant images. |
| D. containerd on hosts, or firecracker-containerd | Tested projects, with layer sharing. | Adds a daemon and a second image store on each host, next to ZFS. Duplicates what Atlas owns. | Reject. |
| E. Docker inside an Ubuntu VM | Works today with no Atlas change. | Not the goal. Adds a full OS and a daemon. Boots slower. | Rejected by the requester. |
One converter binary serves A and C. So moving from A to C changes where it runs and does not rewrite it.
How does init get into the guest?
| Option | Effect | View |
|---|---|---|
Write init to /sbin/init in the disk | The kernel starts it by default, so Metal needs no boot change. One disk and one digest. A new init needs a new image build, as apply-metadata does today. If the image has its own /sbin/init, the builder moves it. On Alpine this path is a symlink to BusyBox, so replace the link and do not write through it. An absolute symlink in an image must not lead the converter out of its directory. Tested on Alpine and Debian images. | Recommended. |
| Add boot arguments to the Metal image request | Explicit. Needs a Metal API field and host upgrades. Metal reads a boot-args file today, but in the repository only the development script writes it. | Use only if the first option fails. |
| Separate small init drive (Fly's public init) | Init can change with no rebuild. Metal must add a second drive to boot, rescue, and migration. Device names change. | Reject for now. |
Proposed design
Trace one image
- An operator runs a command with
nginx:1.29-alpine. The converter resolves the tag to a digest. Atlas stores the digest, because a tag can move. - The converter reads the amd64 manifest, applies the layers in order, adds init and
/.atlas/image.json, and builds ext4. It never mounts the result on a host. - Atlas uploads the compressed disk and creates a
Virtual Machine Image. It links an existing kernel record. It gets the tagpurpose=oci, soget_latest_base_imageignores it. - A VM create request sends the same Metal image object as today: URLs, digests, and architecture. Metal downloads, verifies, clones, and boots, with no OCI knowledge.
- Init configures the guest, then starts the entrypoint.
What init must do
| Job | Today on Ubuntu | In Atlas init | State |
|---|---|---|---|
Mount /proc, /sys, /dev, cgroup2 | systemd | Mount only these. Do not mount over image directories. | tested |
| Start entrypoint with env, user, directory | n/a | From image.json, plus overrides from attributes in the metadata service (MMDS). | tested without overrides |
| Reap child processes as PID 1 | systemd | Wait for all children. | tested |
| IPv4 address | systemd-networkd file in the image | Read ip= from /proc/cmdline and set the address by netlink or ioctl. The kernel passes unknown arguments to init, so do not pass them to the entrypoint. | tested with a fixed address |
MTU 1380, IPv4 and metadata routes, DNS, /etc/hosts | systemd-networkd | Set by netlink. Write the DNS and hosts files. | proposed |
| Mesh IPv6 address and host routes | apply-metadata (Python) | Poll MMDS every 250 ms and apply by netlink. Images may have no Python or ip. | proposed |
| Clock step after memory restore | apply-metadata | Same rule: forward only, gap above 2 s. | proposed |
| Grow file system | cloud-init | Online ext4 resize ioctl at boot and after a disk resize. Images may have no resize2fs. | tested at boot |
| Graceful stop | systemd | Disable Ctrl+Alt+Del reboot. Send the image stop signal, wait, sync, and power off. | tested |
| Entrypoint exit | n/a | Keep the guest running. Restart the entrypoint with a growing delay. Write the exit code to the console. | proposed |
SSH keys and user_data | sshd, cloud-init | Not available. See decisions 4 and 5. | open |
The metadata logic would then exist in Python and in Go. Later, Ubuntu images can use the Go program too, so one implementation remains. Do this as a separate change, because it touches all current images.
What changes in each component
| Component | Change | Compatibility |
|---|---|---|
| Guest init (new Go binary) | Jobs above. Static build. Lives in the Metal Go module. Exact path is for review. | New images only. |
| Converter (new) | Pull, flatten, make ext4. Enforce limits on size and file count. Reject unsafe paths. Consider go-containerregistry for pull and flatten, and mke2fs -d with a tar input to avoid root. mke2fs 1.47 documents this when built with libarchive. Not tested. | New. |
| Atlas app | A build command in image_builder.py style. Optional source reference and digest on the image. Later, a tenant import route. | Optional fields and a Frappe patch. DocType layout needs a mockup and approval first. |
| Metal | None in the first phase. Init owns the restart of the entrypoint, so the guest does not power off when its program exits. | No API or record change expected. |
| Migration, sleep, warm, rescue | No planned code change. The VM is still Firecracker on a ZFS disk. Each needs a test, and init must keep MMDS polling so that a restored guest gets its address. | Must be proven by test. |
Plan
| Phase | Work | Depends on | Done when |
|---|---|---|---|
| 0 | Local boot, network, stop, growth, and restart tests. done | Results above. | |
| 1 | Guest init with network, MMDS, growth, and stop. Boot on a development host from a hand-built disk. | Decisions 2 and 3 | nginx answers over mesh IPv6 and the public path. Stop uses the image signal. Disk resize grows the file system. |
| 2 | Converter and operator command (option A). Public Docker Hub images. Docs. | 1 | The nine images above publish as Available images and boot through the normal VM create flow on a development host. |
| 3 | Test each Atlas feature. Add command and environment overrides. Add exit handling and console access. | 2, decisions 2 and 5 | Restart, migration, sleep and wake, warm start, snapshot, and rescue pass on nginx and postgres. A failed entrypoint is visible to the operator. |
| 4 | Tenant import with a builder VM (option C). Registry credentials. Quotas. Docker Hub paid token. | 3, decision 1 | A hostile archive test stays inside the builder VM. Import failures show on the image record. Retries are safe. |
| Later | Share layers between images, lazy loading, arm64, one metadata agent for Ubuntu and OCI. | Evidence of need | Measured import or boot delay justifies the work. |
Decisions for discussion
- Who uses this first? Operator-selected images, or tenants? Recommendation: operators first. Tenant import brings the untrusted archive problem, registry credentials, and quotas.
- What happens when the entrypoint exits? Options: power off, or keep the guest up and restart the program. A power off needs a Metal change, because Metal starts the guest again while the desired state is running. Recommendation: init restarts the entrypoint with a delay that grows to 60 s, and writes the exit code to the console. The VM stays Running in Atlas, so a failing program does not show in the VM state. Exit codes in the API can come later.
- Does the root disk survive a restart? Fly resets by default. Atlas VMs keep their disk. Recommendation: keep the disk. This is the current Atlas contract, and migration, snapshots, and databases depend on it. A reset mode can come later.
- What does
user_datado on an OCI image? It has no cloud-init. Recommendation: reject the request with a clear error, and do not ignore it silently. This is a new image kind, so no existing client breaks. - How does a person get a shell? Fly has SSH and an API built into init. DigitalOcean has an exec API. Many images have no shell. Recommendation: first phase shows output on the TTY console only. Then add exec through init over vsock or the serial console. The Atlas SSH console needs an SSH service and the key lookup in the guest, so it does not work on these images. The TTY console collects output while the VM runs.
- How does an image update work? The disk holds both the image files and the data, so a new image cannot replace the old one in place. Recommendation: a new image means a new VM until network volumes exist. Fly can replace it because its volumes are separate. This is the largest product difference from Fly.
Risks and limits
- Untrusted archives. Path traversal, symlink escape, and decompression bombs are the main risks. Mitigations: limits, path checks, and option C for tenants. Atlas already accepts tenant-controlled ext4 through Machine images, so the host risk from the disk itself is not new.
- Logs. Application output goes to the serial console, which replays only recent output. There is no durable log store in this plan.
- Kernel features. With no modules, images that need extra netfilter or similar modules can fail. We need to test which features are absent.
- Time sync. The guest has no time service. Metal steps the clock after a restore. Long-term drift is not measured.
- Registry dependency. After import, the image lives in Atlas object storage. So a Docker Hub outage stops only new imports, not VM starts.
- Licenses. Atlas stores a copy of each third-party image. Check this for images that an operator publishes to all tenants.
Not tested yet
- Anything on an Atlas host:
metald, jailer, ZFS, cgroup limits, mesh IPv6, public access, migration, sleep, warm start, and rescue. - The Metal reaction to a guest exit. We read the code only.
- Applying metadata from MMDS: mesh address, host routes, hostname, and clock step. The test address was fixed. Ubuntu memory use, for comparison.
- A disk resize while the guest runs. The growth test ran at boot.
- The reasons that Traefik did not open port 8080. It likely needs configuration, which we did not give it.
Sources
- Fly.io: Docker without Docker
- Fly.io: public init source
- Fly.io: A new way to RootFS
- Fly.io: persist_rootfs
- Fly.io: Machines overview
- DigitalOcean: MicroVMs for agents
- DigitalOcean: MicroVM architecture
- DigitalOcean: MicroVMs public preview
- Railway: Infrastructure Engineering and Railway: builder
- containerd: devmapper snapshotter
- OCI: image layers and whiteouts and OCI: image configuration
- Docker Hub: pull usage and limits
- Linux: reboot(2), Ctrl+Alt+Del behavior