Introducing a new way to review your PRs.

Read the announcement

arcboxlabs / arcbox

Run AI agents on real and isolated machines — own kernel, filesystem, and network — with <100ms boot. Local first, OCI compatible, pure Rust.

View on GitHub

32 documents · Updated Nov 6, 2026

docs / api-and-docker-compatibility

API and Docker compatibility

ArcBox exposes two client-facing service layers. The control-plane API lets desktop and engineering clients manage ArcBox and observe its state. The Docker-compatible service lets existing Docker clients manage workloads through a local Unix socket while ArcBox keeps the workload inside its managed Linux environment.

Public API layer

The public API layer is the daemon's control interface. It uses one service set for Connect, gRPC, and gRPC-Web so clients with different protocol needs can reach the same ArcBox operations through the control-plane Unix socket. The layer covers machine control, sandbox work, system status, statistics, Kubernetes access, migration, icons, and platform-specific operations. app/…/lib.rs• L1-21 app/…/mod.rs• L1-23 app/…/mod.rs• L260-315

The icon lookup is a small public API feature that turns a fully qualified image name into an icon URL and a source label. A known image returns its resolved source. An image with no known icon returns a successful response with an empty URL and not_found, while a lookup failure is reported as an internal API error. app/…/icon.rs• L11-37 app/…/icon.rs• L61-77 rpc/…/api.proto• L484-502 app/…/icon_test.rs• L9-58

The control plane starts early in daemon startup. This lets clients observe setup while the runtime is still preparing, instead of waiting for the workload environment to become ready. Normal runtime calls remain unavailable until the runtime is ready, while system status and startup diagnostics remain available during that period. app/…/services.rs• L28-59 app/…/system.rs• L27-163

The daemon serves the API over arcbox.sock. A single protocol-aware HTTP server accepts HTTP/1.1 and HTTP/2. This supports Connect and gRPC-Web clients over HTTP/1.1 and native gRPC clients over HTTP/2. app/…/control_plane.rs• L1-11 app/…/control_plane.rs• L32-68

Sandbox API surface

The Sandbox V1 API gives clients one boundary for sandbox lifecycle, process, filesystem, snapshot, template, event, and port operations. The daemon serves the API locally and forwards guest work to the selected sandbox location, so clients do not need to know whether a workload runs in the host manager or the System VM agent. app/…/mod.rs• L1-23 app/…/mod.rs• L260-315

The API separates state-changing control calls from data flows that carry files, process output, or event updates. Reads and streams can keep a paused sandbox's recorded state available, while operations that need a live sandbox may resume it unless the client sends the opt-out metadata. Server streams add keepalive frames so an idle connection remains usable through a proxy. app/…/control.rs• L86-113 app/…/filesystem.rs• L23-28 app/…/process.rs• L43-52 app/…/mod.rs• L80-96

References: app/…/mod.rs• L1-23 app/…/mod.rs• L260-315 app/…/control.rs• L86-113 app/…/filesystem.rs• L23-28 app/…/process.rs• L43-52

Sandbox location routing

Sandbox requests use the System VM by default when nested execution is available. When the daemon has a host sandbox manager, new requests use that host location by default, and requests for an existing sandbox return to the location that owns its identity. The public request metadata still accepts only the System VM for Sandbox V1, which keeps this choice internal to the daemon. app/…/sandbox_route.rs• L1-13 app/…/sandbox_route.rs• L68-132 app/…/mod.rs• L155-201

The API reports location capabilities before a client starts work. Unsupported nested execution returns a clear failed-precondition result instead of dialing an unusable guest, while host and nested listings use a page token that preserves the location boundary between pages. Snapshot restore follows the location that owns the snapshot, and template operations follow the current default location. app/…/control.rs• L40-84 app/…/control.rs• L342-388 app/…/snapshot.rs• L61-95 app/…/template.rs• L1-6

References: app/…/sandbox_route.rs• L1-13 app/…/sandbox_route.rs• L68-132 app/…/mod.rs• L155-201 app/…/control.rs• L40-84 app/…/control.rs• L342-388 app/…/snapshot.rs• L61-95 app/…/template.rs• L1-6

Setup status

Setup status is the public view of daemon startup. Clients can read the current snapshot or watch each later update through SystemService.GetSetupStatus and SystemService.WatchSetupStatus. The phase sequence describes progress toward service readiness, while boolean fields describe lasting conditions such as the Docker socket link, network route, and System VM state. rpc/…/api.proto• L169-207 rpc/…/api.proto• L1017-1095

Clients should use the watch stream as the readiness and failure signal. The daemon publishes a final failed status with an error before it exits, so a client can show the cause instead of treating a closed connection as the only evidence of failure. app/…/system.rs• L61-131 docs/daemon-lifecycle.md• L38-43

References: rpc/…/api.proto• L169-207 rpc/…/api.proto• L1017-1095 app/…/system.rs• L27-131 docs/daemon-lifecycle.md• L38-43

Docker-compatible service

The Docker-compatible service is a local REST boundary for Docker CLI tools and other Docker API clients. Clients connect to docker.sock, often through an ArcBox Docker context, and continue to use familiar container, image, volume, network, and system operations. app/…/README.md• L3-29 app/…/server.rs• L19-39

The service is a compatibility layer rather than a second container engine. ArcBox handles requests that need host-side policy or state, then sends the Docker operation to guest dockerd. Requests that need no ArcBox-specific action pass through to the guest. This keeps Docker behavior in the guest engine while ArcBox adds the host integration needed for managed workloads. app/…/api.rs• L30-59 app/…/api.rs• L109-153

Client access

The Docker socket is the stable client entry point. ArcBox can create and select a Docker context that points to this socket, so a user can switch the Docker CLI to ArcBox without changing workload commands. The daemon enables this integration only after critical startup recovery succeeds. app/…/mod.rs• L34-75 app/…/mod.rs• L270-297 app/…/services.rs• L197-215

The server removes a stale socket before it binds and binds the listener before startup reports the service as ready. This makes a successful readiness report mean that clients can reach the Docker entry point. app/…/server.rs• L60-89 app/…/services.rs• L90-141

References: app/…/mod.rs• L34-75 app/…/mod.rs• L270-297 app/…/services.rs• L90-141 app/…/server.rs• L60-89

Request compatibility

The service accepts both versioned and unversioned Docker paths. It removes a valid /v<major>.<minor> prefix for local route matching, then keeps the original URI for guest forwarding. The guest Docker engine remains responsible for the API version response and version-specific behavior. app/…/api.rs• L61-107 app/…/lib.rs• L9-27

Request handling follows three broad paths:

Request kindArcBox responsibilityDownstream target
ArcBox-owned lifecycle or network actionApply host path, workload, DNS, or port-forwarding effects around the Docker actionGuest dockerd for the Docker operation
Ordinary Docker requestCheck readiness and relay the request and responseGuest dockerd over a reusable connection
Upload or upgraded sessionPreserve streaming or interactive behavior while relaying dataGuest dockerd over a dedicated connection

The local route set stays narrow on purpose. A fallback handles new or unlisted Docker endpoints, which allows newer client requests to reach a capable guest engine without a matching host route for every endpoint. app/…/fallback.rs• L13-20 app/…/forward.rs• L14-18

References: app/…/api.rs• L30-59 app/…/api.rs• L61-107 app/…/api.rs• L109-153 app/…/fallback.rs• L13-20 app/…/forward.rs• L14-18

Workload request flow

Every Docker request must cross the host socket, reach a usable System VM, pass a Docker-level readiness check, and then reach guest dockerd. The following diagram shows how ArcBox combines local policy with guest execution.

flowchart LR
    client[Docker CLI or API client]
    socket[ArcBox Docker Unix socket]
    router[Version normalization and request routing]
    local[ArcBox host-side handling]
    ready[System VM and guest dockerd readiness]
    transport[Guest transport]
    dockerd[Guest dockerd]
    state[Host DNS and port-forward state]

    client --> socket --> router
    router --> local
    router --> ready
    local --> ready
    ready --> transport --> dockerd
    dockerd --> local
    local --> state
    dockerd --> client

The readiness check has two parts. ArcBox first asks the runtime to make the System VM and its container runtime ready. The Docker layer then sends GET /_ping to prove that guest dockerd accepts Docker HTTP requests. This prevents a live VM or open transport from being treated as a usable Docker service. app/…/proxying.rs• L14-35 app/…/state.rs• L69-104 app/…/state.rs• L130-156

Readiness is cached per guest role and invalidated after a transport failure. When the System VM restarts, the proxy drops connections from the old VM before it verifies the new endpoint. Concurrent requests share one verification attempt rather than starting several runtime preparations. app/…/state.rs• L106-123 app/…/state.rs• L194-239

Lifecycle translation

The Docker layer translates Docker lifecycle calls into two outcomes: a request to guest dockerd and a matching change to host-visible workload state. ArcBox tracks this state because containers execute in the managed environment while clients use host names and ports. app/…/mod.rs• L78-109 app/…/mod.rs• L112-146

Container lifecycle

Container creation records the canonical container identity and applies host path rules before the request reaches guest dockerd. Platform selection is also checked at this boundary. Native ARM workloads run in the managed Linux environment, while AMD64 workloads require the in-guest FEX translator; unsupported AMD64 execution fails instead of silently moving the workload to another runtime. app/…/mod.rs• L13-26 app/…/routing.rs• L76-123

Starting a container causes ArcBox to derive its host networking from guest state. Stopping, killing, or removing a container tears down the related host port forwarding and DNS records when the Docker result shows that the container stopped. Network connect and disconnect operations refresh the same DNS view after guest dockerd changes the container's address or aliases. app/…/mod.rs• L99-109 app/…/mod.rs• L131-146 app/…/network.rs• L1-8

Host state also has a reconciliation path. It checks the guest's running container set and removes host state for containers that stopped without a matching API call, such as a natural exit, an out-of-band stop, an OOM kill, or automatic removal. A failed guest query skips cleanup for that cycle to avoid removing state for a container that may still be alive. app/…/host_reconciler.rs• L1-11 app/…/host_reconciler.rs• L51-75

References: app/…/mod.rs• L78-146 app/…/network.rs• L1-8 app/…/network.rs• L90-116 app/…/host_reconciler.rs• L1-11 app/…/host_reconciler.rs• L51-75

Data and session flows

Ordinary requests use reusable HTTP connections and stream responses back to the client. Large image loads and build contexts use a bounded stream so client backpressure reaches guest dockerd. Attach, exec, and BuildKit-style sessions use an upgraded connection that stays dedicated to the interactive byte stream. app/…/forward.rs• L42-60 app/…/upload.rs• L22-26 app/…/upgrade.rs• L153-170

These paths preserve different client contracts. A normal request needs safe reuse, an upload needs correct streaming and early-response handling, and an interactive request needs bidirectional ownership after the upgrade. Keeping these flows separate prevents one protocol shape from corrupting another. app/…/README.md• L151-162

References: app/…/forward.rs• L14-18 app/…/upload.rs• L22-26 app/…/upgrade.rs• L153-170 app/…/README.md• L151-162

Guest reachability

The production Docker proxy reaches guest dockerd through a vsock connection selected by the ArcBox runtime. The connector obtains the managed VM's Docker endpoint, opens the guest transport, and presents it to the proxy as an async stream. Integration tests can use a Unix socket through the same connector boundary. app/…/connector.rs• L29-42 app/…/README.md• L164-170

The proxy uses an internal authority to keep connection pools separate when requests target different utility VM roles. The authority selects the pool and role; the guest request still uses the local Docker host identity. This lets role selection remain a host concern without changing what guest dockerd receives. app/…/README.md• L125-149

Container ports reach clients through host-side forwarding. ArcBox reads the port bindings reported by the guest and opens host listeners that forward traffic to the guest's published port. The relay targets the host port because guest dockerd owns the published-port DNAT from that port to the container port. Container names and aliases reach clients through host DNS entries derived from guest inspection. app/…/mod.rs• L102-106 app/…/network.rs• L90-116 app/…/port_bindings.rs• L12-20 app/…/port_bindings.rs• L23-88

References: app/…/connector.rs• L29-42 app/…/README.md• L125-149 app/…/README.md• L164-170 app/…/mod.rs• L102-106 app/…/network.rs• L90-116 app/…/port_bindings.rs• L12-20 app/…/port_bindings.rs• L23-88

This page is part of the Application control plane model. The API and Docker services depend on daemon startup and shutdown rules. The daemon binds the control-plane socket early, binds the Docker socket before it reports network readiness, drains both services during shutdown, and cleans their socket files on exit. See Daemon lifecycle for the full startup, readiness, and shutdown model.

ArcBox keeps privileged host actions outside this service layer. When a workflow crosses a protected host boundary, use Privileged helper boundary to understand which component owns that action.

Change checklist

When these files or sections are changed, remember to consider these:

  • Keep the control-plane service registration and the reflected service description aligned. A service can appear in reflection yet return 404 if it is not added to the served router.
  • Keep sandbox location selection aligned with capability reporting, identity ownership, snapshot ownership, and cross-location page tokens. A request can otherwise reach the wrong manager or expose an unusable location.
  • Keep Docker version-prefix normalization paired with original-URI forwarding. Local routes need the stripped path, while guest dockerd must receive the client request path and query.
  • Keep Docker socket binding ahead of readiness publication. A background bind failure must not produce a ready daemon with an unreachable client entry point.
  • Keep lifecycle changes paired with host DNS and port-forward state changes. Include exits that happen without a Docker lifecycle request.
  • Keep port-forward rules aimed at the guest published host port. The container port is the destination of guest dockerd's own DNAT and is not the relay target.
  • Keep restart generation handling paired with pooled connection reset and Docker _ping verification. A stale connection can otherwise survive a VM incarnation change.
  • Keep upload and upgrade requests on dedicated transport paths. Their body and connection lifetimes do not match ordinary pooled HTTP requests.
  • Keep paused-sandbox resume behavior outside replay-sensitive input streams. A write stream must resume before consuming data that cannot be sent again.

Important failure modes

TriggerConsequenceGuard
Docker socket bind fails after startup continuesClients see connection refusal even though daemon status may appear readyBind the socket before publishing runtime readiness.
VM is up but guest dockerd is not readyDocker requests fail against an endpoint that only appears reachableRun a real guest GET /_ping after runtime preparation.
System VM restarts while pooled connections remainThe proxy sends a request to a dead VM incarnationReset the pool before re-verifying readiness.
Container stops without a matching host API callHost port listeners or DNS names remain staleRun periodic reconciliation against the guest's running set.
Port relay targets the container port instead of the guest published portA published container port can refuse or miss the guest DNAT ruleTranslate each binding to the guest host port used by dockerd's DNAT.
AMD64 workload arrives without FEXThe workload cannot run in the managed Linux environmentFail closed instead of selecting an unrelated runtime.
Streaming upload uses ordinary request forwardingBuild or image-load traffic can stall or lose correct body handlingUse the bounded streaming upload path.
Interactive upgrade uses ordinary pooled forwardingAttach or exec sessions can hang or corrupt pooled HTTP stateUse a dedicated upgraded connection.
Sandbox request lands on an unsupported nested locationThe client receives a guest connection failure instead of a capability resultReport the location capability and reject before dialing the guest.

Key files

FileWhy to read it
app/…/services.rsShows when the control plane and Docker service bind and become ready.
app/…/control_plane.rsShows how Connect, gRPC, and gRPC-Web share one socket and handler set.
app/…/mod.rsShows the public service set, request context rules, keepalives, and router registration boundary.
app/…/sandbox_route.rsShows how sandbox requests select the host or nested location.
app/…/control.rsShows sandbox lifecycle, capabilities, listing, events, and published-port contracts.
app/…/process.rsShows sandbox process and stdio flows, including bounded port waits and auto-resume.
app/…/filesystem.rsShows sandbox file streams and resume rules for read and write operations.
app/…/snapshot.rsShows checkpoint and restore routing by snapshot ownership.
app/…/template.rsShows the template catalog boundary and its default-location behavior.
app/…/system.rsShows setup status snapshots, update streams, and early diagnostics.
rpc/…/api.protoDefines the public system status and control-plane contracts.
app/…/server.rsShows the Docker socket lifecycle and request-serving boundary.
app/…/api.rsShows version normalization, local routes, and fallback routing.
app/…/state.rsShows guest Docker readiness and VM-restart handling.
app/…/mod.rsShows lifecycle translation into guest actions and host networking state.
app/…/host_reconciler.rsShows the backstop for host state after out-of-band container exits.
app/…/port_bindings.rsShows how Docker inspect bindings become host relay rules.
app/…/connector.rsShows how the proxy reaches guest dockerd.
app/…/mod.rsShows how Docker clients are pointed at the ArcBox socket.