{"by":"0kenx","descendants":13,"id":48469039,"kids":[48470919,48472113,48472984,48471982,48472908,48483485,48484969,48469053,48539435,48469871],"score":40,"text":"Hi HN, I&#x27;ve been building Nucleus, a lightweight Linux container runtime focused on two workloads: ephemeral AI-agent sandboxes and declarative NixOS services. It&#x27;s a single Rust binary, no daemon.<p>It is not a Docker replacement and not a strict subset of Docker either. I dropped the entire image-and-distribution half (no Dockerfile, no layers, no registry, no pull&#x2F;push, no persistent storage layer) in exchange for going deeper on isolation and reproducibility. The rootfs is either a directory copied into tmpfs (agent mode) or a Nix-built closure mounted read-only (production mode). If your mental model is &quot;run my image instead of docker run,&quot; this won&#x27;t fit. If it&#x27;s &quot;run untrusted or ephemeral workloads with stronger, auditable isolation on a single host,&quot; that&#x27;s the target.<p>Things that I think are interesting:<p><pre><code>  - Defense-in-depth defaults. All capabilities dropped, ~100-syscall seccomp allowlist (vs Docker&#x27;s ~300), up to 8 namespaces including time&#x2F;cgroup, Landlock LSM path ACLs per service.\n  - Deny-by-default egress. Outbound traffic is denied unless you allow specific CIDRs or DNS-resolved domains. Enforced with namespace-local iptables rules.\n  - Externalized, hash-pinned security policies. seccomp (JSON), capabilities (TOML), and Landlock (TOML) live as separate SHA-256-verified files, decoupled from the rootfs build. There&#x27;s a nucleus seccomp generate that records syscalls in trace mode and emits a minimal profile.\n  - gVisor as a first-class integrated runtime, not an add-on. Explicit network modes including a gvisor-host mode that&#x27;s intentionally separate from native host networking.\n  - Nix-native production path. nucleus.lib.mkRootfs builds locked-down closures; rootfs attestation verifies a per-file SHA-256 manifest at startup; first-class NixOS module.\n  - Formal verification. TLA+ specs for the isolation&#x2F;resource&#x2F;filesystem&#x2F;security&#x2F;gVisor subsystems, checked with Apalache, plus property-based tests that drive the Rust implementation against the specs.\n</code></pre>\nHonest tradeoffs:\n  - Linux x86_64 only. No macOS&#x2F;Windows&#x2F;BSD, no plans.\n  - No CNI, no overlay networks, no cluster orchestration. nucleus compose is a single-host TOML DAG over systemd, not Swarm&#x2F;K8s.\n  - Ephemeral-by-default storage. Persistence is opt-in via explicit --volume binds.\n  - Agent mode applies several mechanisms best-effort by design (warn-and-continue on seccomp&#x2F;Landlock failure). For fail-closed isolation on ephemeral workloads use --service-mode strict-agent; for long-running services use production mode.<p>Cold-start is ~12ms in the native runtime. Postgres 18 pgbench numbers under Nucleus are within noise of bare metal in our harness (full results in benches&#x2F;).","time":1781046220,"title":"Show HN: Nucleus – A security-hardened, Nix-native container runtime","type":"story","url":"https://github.com/sig-id/nucleus"}