sandboxd
sandboxd 是 AKernel 所使用的 Linux 沙箱生命周期服务。它对外暴露一组精简的 gRPC API,负责管理沙箱资源,目前使用 gVisor 运行沙箱。对 Kata Containers 的支持即将开源。
职责
- 启动、等待、检查、度量并删除沙箱。
- 准备本地、OCI、Nydus 以及 S3 后端的 rootfs 和挂载。
- 分配 cgroups(目前仅支持 v1)和 veth 接口,并为 NAT 配置 iptables。
架构
gRPC service
|
sandbox lifecycle manager
├── sandbox runtime adapter ──> gVisor
├── image manager ────────────> distill-fs / OCI
└── resource managers ────────> cgroup v1 / veth / iptables
API / CLI
公开的 protobuf 契约位于 api/runtime/v1/sandbox-api.proto。
sbox 二进制文件是用于管理沙箱的管理 CLI。
构建与测试
make
make test
make vet
特权 E2E 测试套件需要 Docker、cgroup v1、iptables 以及所测试的 runsc 版本:
RUNSC_BINARY=/usr/local/bin/runsc make e2e
开发者测试环境请参见 test/e2e/README.md。AKernel 集成通过 all-in-one 节点镜像以及 AKernel 仓库中的独立部署进行验证。
Protobuf 开发
Protobuf 生成使用由 Makefile 和 tools/protobuf.Dockerfile 定义的固定 Docker 镜像,不依赖宿主机安装的 protobuf 工具:
make protos
make check-protos
将生成的 Go 绑定与对应的 protobuf 变更一并提交。
项目结构
api/ public protobuf API and generated Go code
cmd/sandboxd/ sandboxd daemon
cmd/sbox/ administrative CLI
config/ configuration types and defaults
configs/ AKernel integration configuration templates
internal/server/ gRPC service and daemon orchestration
pkg/runtime/ sandbox runtime abstraction and gVisor adapter
pkg/imagemanager/ rootfs and mount integration
pkg/networkmanager/ veth and iptables integration
pkg/cgroupmanager/ cgroup v1 integration
test/e2e/ privileged runsc E2E
tools/ pinned protobuf code-generation image
已知限制
- 在
v0.1.0中仅支持 gVisor、cgroup v1、netstack 沙箱网络和 iptables。 - 直接 OCI registry 客户端目前会跳过 TLS 证书验证,因此只应与受信任的 registry 一起使用。
许可证
Copyright (c) 2026 Ant Group Corporation.
依据 Apache License, Version 2.0 授权。详见 LICENSE。第三方 Go 模块在 go.mod 中声明,并保留其各自的许可证。
sandboxd
sandboxd is the Linux sandbox lifecycle service used by AKernel. It exposes a small gRPC API, manages sandbox resources, and currently runs sandboxes with gVisor. Kata Containers support will be open-sourced soon.
Responsibilities
- Start, wait for, inspect, measure, and delete sandboxes.
- Prepare local, OCI, Nydus, and S3-backed rootfs and mounts.
- Allocate cgroups (currently v1 only) and veth interfaces and configure iptables for NAT.
Architecture
gRPC service
|
sandbox lifecycle manager
├── sandbox runtime adapter ──> gVisor
├── image manager ────────────> distill-fs / OCI
└── resource managers ────────> cgroup v1 / veth / iptables
API / CLI
The public protobuf contract is api/runtime/v1/sandbox-api.proto.
The sbox binary is an administrative CLI for managing sandboxes.
Build and test
make
make test
make vet
The privileged E2E suite requires Docker, cgroup v1, iptables, and the tested runsc release:
RUNSC_BINARY=/usr/local/bin/runsc make e2e
See test/e2e/README.md for the developer test environment. AKernel integration is validated through the all-in-one node image and standalone deployment in the AKernel repository.
Protobuf development
Protobuf generation uses a pinned Docker image defined by the Makefile and tools/protobuf.Dockerfile, independent of host-installed protobuf tools:
make protos
make check-protos
Commit the generated Go bindings with the corresponding protobuf change.
Project layout
api/ public protobuf API and generated Go code
cmd/sandboxd/ sandboxd daemon
cmd/sbox/ administrative CLI
config/ configuration types and defaults
configs/ AKernel integration configuration templates
internal/server/ gRPC service and daemon orchestration
pkg/runtime/ sandbox runtime abstraction and gVisor adapter
pkg/imagemanager/ rootfs and mount integration
pkg/networkmanager/ veth and iptables integration
pkg/cgroupmanager/ cgroup v1 integration
test/e2e/ privileged runsc E2E
tools/ pinned protobuf code-generation image
Known limitations
- Only gVisor, cgroup v1, netstack sandbox networking, and iptables are supported in
v0.1.0. - The direct OCI registry client currently skips TLS certificate verification and should only be used with trusted registries.
License
Copyright (c) 2026 Ant Group Corporation.
Licensed under the Apache License, Version 2.0. See LICENSE. Third-party Go modules are declared in go.mod and retain their respective licenses.