ArcBox
repository·master·Indexed 41 days ago
https://github.com/arcboxlabs/arcboxA high-performance, open-source container and VM runtime for macOS written in Rust. It serves as a drop-in replacement for Docker Desktop and OrbStack, supporting Docker containers, Kubernetes (via k3s), disposable microVM sandboxes, full Linux VMs, and macOS guests. It includes the `abctl` CLI for machine management and workload migration, and provides a Docker-compatible API server via the `arcbox-docker` crate.
What's inside ArcBox
- arcbox-fs is a high-performance filesystem service designed for ArcBox. It uses the VirtioFS protocol to facilitate file sharing between a host and a guest, providing near-native I/O performance. It works by intercepting FUSE protocol requests from the guest and mapping them directly to host filesystem operations.
Overview of arcbox-docker features
masterThe
arcbox-dockercrate provides a Docker-compatible API server that acts as a host-side proxy. It handles specific lifecycle orchestration via ArcBox handlers and forwards all other requests to the guestdockerd.Supported operations include:
- Container Operations:
create,start,stop,kill,rm,ps,inspect,logs,exec,attach,wait,pause,unpause,top,stats - Image Operations:
pull,push,list,remove,tag,prune - Volume Operations:
create,list,inspect,remove,prune - Network Operations:
list,inspect,create,remove(basic) - System Operations:
info,version,ping,events,df
- Container Operations:
Overview of arcbox-virtio features
masterThe
arcbox-virtiocrate provides paravirtualized device emulation for high-performance I/O between guest VMs and the host. Supported device types include:virtio-blk: Block device with an async file backend.virtio-net: Network device for VM networking.virtio-console: Serial console I/O.virtio-fs: Shared filesystem using the FUSE protocol.virtio-vsock: Host-guest socket communication.VirtQueue: Standard virtqueue implementation with descriptor chains.
Overview of arcbox-api features
masterThe
arcbox-apicrate provides gRPC service implementations built on top of thearcbox-coreruntime state. It currently supports two primary service types:- MachineService: A gRPC service managing the machine lifecycle and facilitating guest-agent pass-through calls.
- MigrationService: A gRPC service providing entrypoints for host-side migration planning and execution.
Overview of arcbox-agent
masterThe
arcbox-agentis a guest-side agent designed to run inside ArcBox Linux guests. It facilitates communication between the host and the guest viavsockon port1024.Its primary responsibilities include:
- Host/Guest Liveness: Responding to Ping requests.
- System Information: Providing guest system details.
- Runtime Readiness: Ensuring the guest runtime stack (
containerd,dockerd, orrunc) is initialized and ready. - Runtime Status: Reporting the current state of the runtime.
- System Initialization: When running as PID 1, it handles mounting filesystems, setting the hostname, and spawning a child reaper process.
- Runtime Bootstrap: Automatically detects and launches the bundled runtime stack (
containerd/dockerd/runc) to ensure the host-side Docker API proxy can connect to a healthydockerdendpoint.
Overview of arcbox-net networking modes and features
masterThe
arcbox-netcrate provides a high-performance network stack for ArcBox VMs. It is designed with a zero-copy data path and a lock-free hot path using SPSC ring buffers to ensure minimal latency and maximum throughput.Networking Modes
- NAT networking: Provides a default shared network with the host.
- Bridge networking: Provides direct L2 connectivity.
- Host-only networking: Creates isolated VM networks.
Core Capabilities
- Port forwarding: Expose guest services to the host.
- DHCP server: Automatic IP assignment for guests.
- DNS forwarding: Transparent DNS resolution.
- Zero-copy packets: Direct guest memory access for high performance.
- Lock-free data path: Uses SPSC ring buffers for the hot path.
Overview of arcbox-cli
masterThe
arcbox-cli(commanded viaabctl) is a thin command-line interface used for managing ArcBox machines and local integration helpers. It is important to note thatarcbox-clidoes not handle Runtime or Docker API serving itself; those tasks are managed by the separatearcbox-daemonbinary.Key capabilities include:
- Machine Management: Creating and managing Linux VMs.
- Runtime Migration: Importing workloads from Docker Desktop or OrbStack.
- Daemon Lifecycle: Starting and stopping the
arcbox-daemon. - Docker Context Integration: Switching between standard Docker and ArcBox.
- Kubernetes Integration: Managing the bundled k3s cluster and
kubectl. - System Helpers: Managing boot assets and DNS resolver setup.
Use arcbox-transport for host/guest communication
masterThe
arcbox-transportcrate provides transport abstractions for communication between an ArcBox host and guest. It offers implementations for both Unix domain sockets and virtio-vsock endpoints, allowing for transport-agnostic code via theTransportandTransportListenertraits.Available transport types:
UnixTransport: Uses Unix domain sockets.VsockTransport: Usesvirtio-vsockendpoints viaVsockAddr.VsockStream: Provides raw async byte streams for callers who already own a connected file descriptor (fd).
use arcbox_transport::{Transport, UnixTransport, VsockTransport}; use arcbox_transport::vsock::VsockAddr; use bytes::Bytes; // Example: Using Unix Domain Sockets let mut unix = UnixTransport::new("/var/run/arcbox.sock"); unix.connect().await?; unix.send(Bytes::from("hello")).await?; // Example: Using Vsock let mut vsock = VsockTransport::new(VsockAddr::new(3, 1024)); vsock.connect().await?; vsock.send(Bytes::from("ping")).await?;Current status of the ArcBox Python SDK
masterThe Python SDK is currently in development (Phases 2a and 2b of CORE-58) and supports both synchronous and asynchronous surfaces. The following features are currently shipped:
Sandbox Management
Sandbox.create,connect,list,kill,pause,info: Note thatpause/resumeare handled daemon-side; data-plane calls will automatically resume a paused sandbox.sandbox.events(): Provides typed lifecycle events (sync reads are blocking; mid-stream drops raiseConnectionLostError).sandbox.set_lifecycle(): Tri-state management (UNCHANGEDto omit,Noneto restore default, or a specific value to replace).sandbox.checkpoint(): Pauses and snapshots the sandbox, returning aSnapshotcatalog row.ArcBox.restore(snapshot_id): Creates a newREADYsandbox from a snapshot. Supportsfresh_network=Truefor concurrent restores. Includeslist_snapshots(auto-paginating) anddelete_snapshot.arcbox.capabilities(): Performs a daemon handshake to retrieve version, protocol, features, and nested virtualization support (cached per client).
Command Execution
commands.run: Executes commands. Returns a foreground result and a backgroundCommandHandle. Supportsstdinasstr|bytes(write-then-close) orTrue(keep open), andpty=PtySize(cols, rows).CommandHandle: Provides streamedoutputwith transparent offset-resume (raisesConnectionLostErroron persistent failure),wait_for_exit,kill,write_stdin,close_stdin,stdin_status, andresize.handle.wait_for_log(pattern): Waits for the first log line matching a substring or compiled regex. Uses SDK-side replayed offset-addressed output. RaisesTimeoutErroron deadline expiration.commands.get(id)/commands.list(): Re-attach a handle via execution ID or list running/exited executions asCommandInfosummaries.
File System
files: Supports whole-file read/write and path verbs:stat,list,mkdir(withmkdir -psemantics),remove, andmove. Uses a frozenFileStatdataclass. Paths acceptstrorPurePosixPath.files.watch(path): Provides a typedFsEventstream viaAsyncFileWatch/FileWatchcontext managers. Renames are paired and keepalives are filtered. Mid-stream drops raiseConnectionLostError(events cannot be replayed).
Networking
ports.wait_for_port(port): Waits for a guest-side listen-table entry (no client polling). RaisesTimeoutErroron expiry (daemon default 30s, cap 600s).ports.expose(port)/unexpose/list: Publishes a guest port on the host loopback (TCP/UDP).listreads the daemon's authoritative live listener table.
Templates
Template.build(name, ...): Builds a catalog template from a single source (image=local Docker ref,dockerfile=inline content, orsnapshot=checkpoint promotion). Supportsready_probe_port,ready_probe_command, andprewarm=True(boot-to-READY warm snapshot). Builds block until complete.Template.get,list,delete_reference: Resolvesname[:version](bare name is newest published; otherwise draft). Supports auto-paginating lists.instance.publish(version)/delete():publishfreezes a draft immutably;deleteremoves it.create(template=Template | "name[:version]"): Creates a sandbox. ATemplateinstance pins its exact reference. Overridingvcpusormemory_mibreplaces limits wholesale;no_default_cmdorno_default_envsuppresses inherited values.
Use arcbox-container for container models and exec orchestration
masterThe
arcbox-containercrate provides the foundational data models and execution primitives for managing containers within the ArcBox ecosystem. It is designed to be used by higher-level services rather than acting as a standalone container manager.Key components include:
- Container Configuration: Use
ContainerConfigto define parameters for container creation. - Container Identity & Lifecycle: Use
ContainerandContainerStateto track container identity and its current lifecycle status. - Execution Orchestration: Use
ExecManagerand related types (likeExecInstance,ExecConfig, andExecId) to implementdocker exec-style workflows. - Agent-backed Execution: Supports optional execution operations via
ExecAgentConnection.
use arcbox_container::{Container, ContainerConfig, ContainerState}; let config = ContainerConfig { image: "alpine:latest".to_string(), cmd: vec!["sh".to_string()], ..Default::default() }; let container = Container::with_config("demo", config); assert_eq!(container.state, ContainerState::Created);- Container Configuration: Use
Use arcbox-grpc gRPC bindings
masterThe
arcbox-grpccrate provides gRPC client and server bindings for ArcBox services usingtonic. It contains service modules generated from thearcbox.v1package, with protobuf messages sourced fromarcbox-protocol.All generated services are accessible under the
arcbox_grpc::v1::*namespace. For convenience, the crate root re-exports several primary clients and servers.use arcbox_grpc::MachineServiceClient; use arcbox_protocol::v1::ListMachinesRequest; let request = tonic::Request::new(ListMachinesRequest { all: true }); // client.list(request).await?;What is splicetcp and how does it work
mastersplicetcpis a userspace TCP-termination and splice bridge used in ArcBox. It acts as a frame plane between an L2/L3 packet source and an egress dialer.Key Characteristics:
- Not a full TCP/IP stack: The guest kernel maintains ownership of the guest TCP state.
splicetcponly manages outbound SYNs, synthesizes the handshake, mirrors minimal sequence/ack state, and splices bytes between guest frames and host sockets. - Flow Promotion: It classifies Ethernet frames and promotes established TCP flows to a "fast path" backed by a real host
TcpStream. - Core Components:
classifier::FrameClassifier: A pure Ethernet-frame demultiplexer.tcp_bridge::TcpBridge: Handles SYN gating, handshake synthesis, and the fast path.egress::EgressResolver: The policy/dial seam used to map flows to outbound connections.direct_rx::{ConnSink, PromotedConn}: Allows callers to take ownership of host→guest reads.shim: Adapts L3 links (likeutun) to the L2 classifier by adding/removing synthetic Ethernet headers.
- Not a full TCP/IP stack: The guest kernel maintains ownership of the guest TCP state.