gvx runs unmodified Linux containers (OCI images) and Linux ELF64 binaries on Windows, macOS, and Linux inside a single unprivileged host process. It does not boot a Linux virtual machine, install a kernel driver, or run a background daemon.
It is built on Google's gVisor user-space application kernel (Sentry and netstack), ported to Windows (amd64, arm64) and macOS (arm64) alongside Linux (amd64, arm64) while modifying less than 5.0% of upstream gVisor files (4.12% at UPSTREAM_COMMIT). Guest Linux code runs directly on the host CPU, and gvx intercepts Linux system calls in user space through the rungv CLI or the pkg/gvx Go SDK.
# Run an Alpine container directly on Windows, macOS, or Linux (no daemon, no sudo)
./rungv run alpine:3.20 uname -a
# Run Nginx with port forwarding, a persistent .ext4 rootfs or data volume, and a live host directory
./rungv run -p 8080:80 -rootfs-volume nginx-root -v appdata:/var/lib/nginx -workspace=./my-site nginx:alpine
# Checkpoint a running sandbox to disk and restore it later
./rungv checkpoint -control-socket ./ctrl.sock -checkpoint-dir ./snap
./rungv restore -checkpoint-dir ./snapUpstream gVisor (runsc) is an OCI runtime for Linux hosts. On Windows and macOS, tools like Docker Desktop, WSL2, Lima, and Podman Desktop run Linux containers by booting a persistent Linux utility VM in the background.
gvx takes the opposite approach: it runs gVisor's user-space Linux kernel directly as a normal Windows or macOS process. Without a Linux VM, gvx still runs unmodified dockerd (docker:dind), single-node and multi-node Kubernetes clusters (rancher/k3s), containerd, runc, and Calico CNI with NetworkPolicy enforcement.
| Property | gvx (whpx / hvf) |
gvx (systrap) |
WSL2 / Lima / Docker Desktop |
|---|---|---|---|
| Host OS | Windows (amd64, arm64), macOS (arm64) |
Linux (amd64, arm64), Windows (amd64, arm64) |
Windows, macOS |
| Background VM / Daemon | None (single process per sandbox) | None (single process per sandbox) | Persistent Linux VM + daemon |
Admin / root Required |
No | No | Yes (initial VM/driver setup) |
| Typical Cold Start | ~20 ms (cached EROFS layer) |
~25 to 65 ms (cached EROFS layer) |
800 to 2500 ms (when VM is cold) |
| Base Memory Overhead | ~16 MiB per sandbox process |
~16 MiB per sandbox process |
512 MiB+ reserved for utility VM |
| Workload Coverage | CLI tools, databases, dockerd, k3s + Calico CNI |
CLI tools, databases, dockerd, k3s + Calico CNI |
Full Linux kernel inside the VM |
| Cross-Arch Emulation | Host CPU arch (amd64 or arm64) |
Host CPU arch (amd64 or arm64) |
Via QEMU binfmt_misc / Rosetta |
- Docker Engine and Kubernetes (
k3s+ Calico CNI) in one process:gvximplements cgroup v2 (memory.max,cpu.max),overlayfs,pivot_root, netfilter/iptables (addrtype,conntrack,xt_recent,rpfilter,set),ipset, VXLAN, and kernel WireGuard netlink (wg0). An unmodifiedrancher/k3sserver or multi-node cluster boots insidegvx, passes Kubernetessonobuoyconformance checks (Quickand[sig-network] Services), and enforces podNetworkPolicyrules withflannel(wireguard-native) or Calico VXLAN. - Portable, journaled single-file volumes (
ext4lite): Databases (PostgreSQL,SQLite),dockerd, andk3srely on POSIX filesystem semantics (overlayfswhiteouts, xattrs, hard links, atomic rename, andfsyncdurability) that break on Windows NTFS or case-insensitive macOS APFS.ext4litestores each named volume (-v data:/var/lib/data) as a standard Linuxext4image file (<name>.ext4) with ajbd2journal and dynamic 16 MiB block groups. Volumes start small, grow on demand, recover from crashes through journal replay, and mount unmodified withmount -o loopon Linux. - Embedded Linux sandboxes in Go (
pkg/gvx): Launch isolated Linux containers or ELF binaries from a Go library call without shipping a VM image or requiring Docker Desktop. - Lockdown-safe Checkpoint and Restore (
rungv checkpoint/restore): Snapshot a running sandbox's task graph, memory pages,ext4litevolumes, and child network namespaces to a directory bundle, then resume execution in milliseconds.
- User-space application kernel vs. hardware kernel:
gvxserves system calls in user space rather than booting a hardware Linux kernel image. Kernel modules (insmod), eBPF programs (such as Cilium's eBPF datapath),io_uring, andnftablesare not supported;dockerd,k3s, and Calico run using theiptables-legacybackend (IPTABLES_MODE=legacy). - Same-architecture execution: Guest binaries run natively on the host CPU without instruction translation (
linux/arm64on Apple Silicon and Windows ARM64;linux/amd64on x86_64 Windows and Linux). - Windows
whpxvs.systrap: On Windows, hardware-assistedwhpx(WinHvPlatform.dll) is the default engine. When Hyper-V / WHPX is unavailable,gvxoffers a user-modesystrapengine (-platform=systrapor-allow-unconfined-systrap) for trusted workloads. Because the Windows kernel does not provide an unprivileged syscall filter like Linuxseccomp, always usewhpxfor untrusted code on Windows.
When you start a container with rungv or pkg/gvx, the host process compiles OCI image layers into cached .erofs files, opens all host file handles and sockets up front, locks down its own OS process privileges, and enters the guest execution loop.
- CPU Ring and 4 KB Paging (
whpx,hvf,systrap):- On macOS (
arm64),pkg/sentry/platform/hvfruns guest code inside an AppleHypervisor.frameworkvCPU with 4 KB Stage-1 guest pages over 16 KB host pages. - On Windows (
amd64,arm64),pkg/sentry/platform/whpxruns guest code inside a Windows Hypervisor Platform (WinHvPlatform.dll) partition with 4 KB EPT / Stage-2 mappings. - On Linux (
amd64,arm64) and Android (arm64, including 16 KB page kernels),gvxusessystrap(seccomp, shared-memory trampolines, and 4 KB sub-block paging).
- On macOS (
- In-Memory OCI-to-EROFS Compilation (
pkg/oci):- Extracting a Linux container
.tarlayer onto Windows NTFS or default macOS APFS breaks case-sensitive filenames (Makefilevsmakefile), device nodes, and Windows reserved names (CON,AUX,NUL). pkg/ocinever extracts container layers onto the host filesystem. It streams.tar.gzand.tar.zstlayers in memory and compiles them into read-only<sha256>.erofsimages cached on disk. By default,gvxmounts them under an in-memorytmpfsupper layer;-rootfs-volume(Config.RootVolume) mounts anext4liteimage as the persistent overlay upper layer instead.
- Extracting a Linux container
- Single-File Journaled
ext4Volumes (pkg/sentry/fsimpl/ext4lite):- Named volumes (
-v appdata:/var/lib/data) useext4lite, a pure-Go VFS2 driver that formats and mounts a single<name>.ext4file on the host. ext4litedivides disk space into 16 MiB block groups with extent trees, inline data for small files, directory indexing, extended attributes (security.*,trusted.overlay.*), and an ordered metadata journal (jbd2). When sparse hole punching (FSCTL_SET_ZERO_DATAorF_PUNCHHOLE) is unavailable,ext4litefalls back to dense block allocation and compacts unused tail groups on unmount.
- Named volumes (
- Pinned Host Directory Sharing (
pkg/sentry/fsimpl/hostfs):- When you mount a host directory with
-workspaceor-v ./src:/src,hostfsopens every path relative to a pinnedos.Rootdirectory handle (NtCreateFilewithFILE_OPEN_REPARSE_POINTon Windows;openatwithO_NOFOLLOWon macOS and Linux). It encodes Windows-invalid characters and case collisions with a stateless~gvx~prefix and bridges host filesystem events into guestinotifywatches.
- When you mount a host directory with
- Driverless Networking (
pkg/netbackend):-net=natruns gVisor's user-space TCP/IP stack (netstack) and relays outbound guest TCP and UDP flows through unprivileged host Gonetsockets. It supports static port forwards and ranges (-p), host Unix socket forwarding (-p unix:path:port), opt-in dynamic loopback publishing (--auto-publish), andhost.docker.internal(10.0.2.2).-net=wgroutes L3 packets fromnetstackthrough an in-memorywireguard-goendpoint over one unprivileged host UDP socket, with noWinTun.dllor/dev/tundriver.
- Pre-Execution Host Self-Lockdown (
pkg/hostlockdown):- Before executing the first guest instruction,
gvxopens all.erofslayers,.ext4volume files, workspace directory handles, and static listeners, then callshostlockdown.Apply(). - Linux installs a Landlock filesystem ruleset scoped to mounted paths, followed by a
seccomp-bpffilter. - macOS applies a Seatbelt profile (
sandbox_init) denyingprocess-forkand unboundfile-*paths. - Windows lowers the primary token to Untrusted integrity, applies a Restricted Token and Job Object (
JOB_OBJECT_LIMIT_ACTIVE_PROCESS = 1,JOB_OBJECT_UILIMIT_ALL), and routes post-lockdown workspace opens through an in-process file broker without changing host NTFS ACLs. Outbound NAT and--auto-publishloopback binds run through a Low-integrity socket broker.
- Before executing the first guest instruction,
Download a prebuilt archive from Releases or build from source with Go 1.27.4+.
Important
On macOS, sign the binary with entitlements.plist so it can call Hypervisor.framework. On Windows, enable the "Windows Hypervisor Platform" optional feature for whpx execution. On Linux, build with CGO_ENABLED=0.
- Run
scripts/repro-build.shto buildrungv. - Sign the binary with
entitlements.pliston macOS.
# macOS (Apple Silicon arm64)
./scripts/repro-build.sh ./rungv ./cmd/rungv
codesign --sign - --entitlements entitlements.plist --force ./rungv
# Windows (amd64 or arm64, in Git Bash)
./scripts/repro-build.sh ./rungv.exe ./cmd/rungv
# Linux (amd64 or arm64)
./scripts/repro-build.sh ./rungv ./cmd/rungvSee docs/cli.md for the complete command and flag reference, docs/recipes/docker-engine.md to run dockerd inside gvx, and docs/recipes/kubernetes.md to run a single-node or multi-node k3s Kubernetes cluster.
- Run a command in an OCI image.
- Run a service with port forwarding (
-p), a persistent.ext4volume (-v), and a shared workspace (-workspace). - Run a sandbox with a pre-bound checkpoint socket, snapshot it to disk, and restore it.
- Route container traffic through a WireGuard tunnel (
-net=wg).
# 1. Run an interactive or one-shot container
./rungv run alpine:3.20 uname -a
# 2. Run Nginx with port forwarding, a named .ext4 volume, and a host workspace
./rungv run -p 8080:80 -v appdata:/var/lib/nginx -workspace=./my-site nginx:alpine
# 3. Checkpoint a running container and restore it from disk
./rungv run -control-socket ./ctrl.sock -checkpoint-dir ./snap alpine:3.20 sh -c "sleep 300" &
./rungv checkpoint -control-socket ./ctrl.sock -checkpoint-dir ./snap
./rungv restore -checkpoint-dir ./snap
# 4. Run Python over a user-space WireGuard tunnel (blocks local LAN access)
./rungv run -net=wg -wg-conf=./sandbox-wg.conf python:3.12-alpine \
python3 -c "import urllib.request; print(urllib.request.urlopen('https://example.com').status)"| Command | Synopsis | Description |
|---|---|---|
run |
rungv run [flags] IMAGE [COMMAND [ARG...]] |
Run a command inside an OCI image or a local Linux ELF64 binary (-bin). |
checkpoint / restore |
rungv checkpoint -control-socket PATH / rungv restore -checkpoint-dir DIR |
Save a running sandbox (snapshot) or resume a saved bundle (resume). |
image (pull, images, rmi, inspect, tag, save, load) |
rungv image <subcommand> |
Pull, list, inspect, tag, save, load, remove, or prune cached OCI images. |
volume |
rungv volume <create|ls|inspect|compact|rm|prune> |
Create, inspect, compact, remove, or prune local ext4lite and hostfs volumes. |
system / info |
rungv system <info|df|prune> / rungv info |
Probe host backends, show cache and volume usage, or prune local storage. |
login / logout |
rungv login [SERVER] / rungv logout [SERVER] |
Store or remove registry credentials in the Docker config store. |
stub / tune / completion |
rungv stub / rungv tune list / rungv completion SHELL |
Probe systrap readiness, list runtime tunables, or print shell completions. |
version / license |
rungv version / rungv license |
Print version metadata or embedded open-source licenses. |
Use pkg/gvx to launch and control sandboxes directly from Go without shelling out to a CLI binary.
Caution
Always defer sb.Close() immediately after gvx.New() or gvx.Restore() succeeds. Omitting sb.Close() leaks hypervisor partitions, shared memory mappings, and open file handles.
- Construct a
gvx.Configwith the image, command, mounts, and network mode. - Call
gvx.New(ctx, cfg)to prepare resources and lock down the host process. - Call
sb.Run(ctx)(orsb.Start(ctx)followed bysb.Checkpoint(ctx, opts)).
package main
import (
"context"
"fmt"
"os"
"z.gfire.dev/gvx/pkg/gvx"
)
func main() {
ctx := context.Background()
sb, err := gvx.New(ctx, gvx.Config{
Platform: gvx.PlatformAuto,
NetworkMode: gvx.NetModeNAT,
OCIImage: "alpine:3.20",
WorkspacePath: "./repo",
Argv: []string{"/usr/bin/git", "status"},
Stdout: os.Stdout,
Stderr: os.Stderr,
})
if err != nil {
fmt.Fprintf(os.Stderr, "init sandbox: %v\n", err)
os.Exit(1)
}
defer sb.Close()
exitCode, err := sb.Run(ctx)
if err != nil {
fmt.Fprintf(os.Stderr, "run sandbox: %v\n", err)
os.Exit(1)
}
os.Exit(exitCode)
}gvx runs Linux binaries and OCI images matching the host CPU architecture (linux/amd64 on amd64, linux/arm64 on arm64).
| Host OS & CPU | Primary Engine | Fallback Engine | Notes |
|---|---|---|---|
macOS arm64 (Apple Silicon M1 to M5) |
hvf (Hypervisor.framework) |
None | Requires com.apple.security.hypervisor code-signing entitlement. |
Windows amd64 (Intel / AMD) |
whpx (WinHvPlatform.dll) |
systrap (opt-in) |
whpx requires Windows Hypervisor Platform. systrap requires -platform=systrap or -allow-unconfined-systrap. |
Windows arm64 (Snapdragon X) |
whpx (WinHvPlatform.dll) |
systrap (opt-in) |
whpx on Windows 11 24H2+; systrap runs without a hypervisor for trusted workloads. |
Linux amd64 & arm64 |
systrap |
None | Supports both 4 KB and 16 KB host page kernels (including Android 15/16 arm64). |
| Document | Contents |
|---|---|
docs/cli.md |
Complete rungv command reference, flags, tunables, mounts, checkpoint/restore, nested use, and Android usage. |
docs/recipes/docker-engine.md |
Recipe: Run dockerd inside a gvx sandbox with an ext4lite volume and connect your host docker CLI. |
docs/recipes/kubernetes.md |
Recipe: Run single-node or multi-node k3s Kubernetes clusters (with flannel or Calico CNI) inside gvx. |
docs/architecture.md |
Internal architecture, Tier 1/2/3 upstream isolation model, containerd control shim, memory/handle ownership, and CI guide. |
docs/systrap-windows.md |
Engineering deep dive and measurements for the Windows user-mode systrap engine. |
docs/moonshots.md |
Future architecture proposals (virtgpu and confined host GPU renderer for browser and GUI guests). |
SECURITY.md |
Threat model, security boundaries per platform, and vulnerability reporting policy. |
CHANGELOG.md |
Release notes for each version. |
gvx is licensed under the Apache License, Version 2.0. See LICENSE for the full text.
gvx tracks the official go branch of google/gvisor (Apache License 2.0, Copyright The gVisor Authors) and pins the synced commit SHA in UPSTREAM_COMMIT (tools/upstream/sync_manifest.json). Rather than maintaining a diverging hard fork, gvx enforces a three-tier isolation boundary verified on every CI run by go run ./tools/upstream -mode=audit -max-ratio=0.042 (within the < 5.0% budget):
- Tier 1 (Additive Packages,
0.0%upstream overlap): Windows/macOS hypervisor engines (whpx,hvf,hvcommon),ext4lite,hostfs,pkg/oci,pkg/netbackend,pkg/hostlockdown,pkg/gvx,cmd/rungv, andtools/gostateifylive in standalone packages that never collide with upstream gVisor. - Tier 2 (OS-Specific Sibling Files): Platform bindings live in
*_windows.go,*_darwin.go, and*_xplat.gosibling files alongside unmodified upstream*_linux.gofiles. - Tier 3 (Minimal Upstream Seams,
< 5.0%): Fewer than5.0%of upstream gVisor files (105 / 2,550files,4.12%) carry build-tag expansions or hook seams.tools/upstream -mode=syncruns automated 3-way merges (git merge-file) across upstream releases.
Run rungv license to print the full license texts of gvx, upstream gVisor, the Go standard library, and all linked third-party Go modules, or rungv license -list for the SPDX summary table.
| SPDX identifier | Third-party modules |
|---|---|
Apache-2.0 |
github.com/distribution/reference v0.6.0, github.com/google/btree v1.1.2, github.com/opencontainers/image-spec v1.1.1 |
Apache-2.0 AND BSD-3-Clause AND MIT |
github.com/klauspost/compress v1.20.5 |
BSD-3-Clause |
golang.org/x/arch v0.32.0, golang.org/x/crypto v0.57.0, golang.org/x/exp v0.0.0-20250711185948-6ae5c78190dc, golang.org/x/mod v0.41.0, golang.org/x/net v0.60.0, golang.org/x/sync v0.23.0, golang.org/x/sys v0.48.0, golang.org/x/text v0.42.0, golang.org/x/time v0.15.0, google.golang.org/protobuf v1.36.11 |
MIT |
golang.zx2c4.com/wintun v0.0.0-20230126152724-0fa3db229ce2, golang.zx2c4.com/wireguard v0.0.0-20261006164505-2631ce99a06f, gopkg.in/yaml.v3 v3.0.1 |
NOASSERTION |
github.com/opencontainers/go-digest v1.0.0 |