Keyboard shortcuts

Press ← or → to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

The Zygo book

← Previous page: the project README — the book’s first page, and the five-minute version of everything below.

All of Zygo’s documentation, in one place, written to be read from the start.

It begins with Container 101: what the Linux kernel gives you to build a sandbox, and what Docker builds from it. Then it explains Zygo — how it works, where it saves time and memory, and how it compares with everything around it. Then it teaches you to use it, and ends with the full reference: every command, every flag, every field, every file and every exit code. You do not need to know any of it already. If you can use a shell and you know what a process is, you can read every page.

Each section is short on purpose — a few sentences, a picture where one helps, and a link to the detail. Read Parts I and II once; after that, the headings work as a reference. This book is the source of truth: when Zygo changes, the book changes in the same commit (AGENTS.md).

Part I — Container 101

0The project READMEWhat Zygo is, why it exists, and how to try it — the first page.
1The kernel and the processWhat a process is, how one is born, and who may do what.
2NamespacesHow a process gets its own view of the machine.
3Control groupsHow a group of processes gets a limit on what it can use.
4The other locksCapabilities, seccomp, Landlock, the root filesystem, the network.
5DockerWhat a container is, what an image is, and where Docker’s time goes.

Part II — Zygo, explained

6How Zygo worksThe one-shot sandbox, the warm zygote, and the parts around them.
7Where the time and memory are savedEach saving, how big it is, and what it costs.
8The rules Zygo is built onEight principles, and the price of each.
9FreeBSD jails, and ZygoThe older idea, and whether “jails for Linux” is fair.
10Similar projects, and Docker side by sidensjail, bubblewrap, kern, gVisor, Firecracker…; docker run against zygo run, flag by flag.

Part III — Using Zygo

11Getting startedInstall, check the host, run a sandbox, warm a function.
12One-shot sandboxeszygo run, step by step.
13Warm functionsHandlers, warm-exec, runtime pools, and living with them.
14Limits, networking and secretsWhat each limit does, the egress allowlist, secrets as files.
15Images and dependenciesRegistries, venvs, apt layers, bytecode, cleaning up.
16Deploying and running in productionzygo up, watching, upgrading, containers, Kubernetes, capacity.
17The HTTP API, the SDKs and MCPCalling Zygo from a program or an AI agent.
18Writing an agentA warm path for a language of your own.

Part IV — Reference

19Every commandEvery command and flag, with defaults and exit codes.
20sandbox.toml, field by fieldEvery section and field, its default and its rules.
21Environment, files and exit codesEvery variable read, every file written, every way it ends.
22TroubleshootingThe errors people hit, and the fix for each.

Part V — Security and speed

23Security: the threat modelEvery attack, what stops it, and whether a test tries it.
Fork safety, question by questionWhat a forked request shares, what it does not, and where that is weaker than it sounds.
24Seccomp profilesThe three syscall profiles, and which to choose.
25What Zygo costsEvery measured number, and the machine it came from.

Part VI — Decisions

26Why it is built this wayThe design decisions in plain words; the full records are in adr/.
GlossaryEvery term in the book, in one line each.

Where to start

  first time here? ────────────────▶ the README, then this page
  new to containers? ──────────────▶ Part I, then Part II
  know Docker, new to Zygo? ───────▶ chapters 6, 7, 10, then 11
  want to use it today? ───────────▶ chapter 11, then 13
  looking something up? ───────────▶ Part IV
  deciding whether to trust it? ───▶ chapter 23

Three sentences to hold on to

  1. A container is not a thing in the kernel. It is a normal process with several limits put on it; the kernel has no idea what a “container” is.
  2. The limits are cheap; the tools around them are not. Setting up the limits takes about a millisecond. Docker takes hundreds, and most of that is programs talking to programs.
  3. Zygo removes the tools, then removes the start-up. It sets the limits up itself, in one process, and then keeps a ready copy of your program waiting, so a request costs one fork().

How the numbers are used

Every number about Zygo in this book comes from chapter 25, which names the machines and the commands. Numbers about other projects are their own claims or commonly measured ranges, and they are marked that way. zygo bench all repeats Zygo’s numbers on your own machine.