# Container engines (experiment)

If you run celld, a patched build can start its containers as Hermitbox sandboxes, through the
public API, beside its default Docker engine. Pointing a Docker client at Hermitbox does not work
yet: the [Docker socket experiment](#docker-socket-experiment) is unshipped, and a real build
through it fails.

## Run celld's containers on Hermitbox

The patch, in [integrations/celld/upstream](https://github.com/hermitbox/hermitbox/blob/cdd62e6c07e07c2b649b726729b4d8da6b25a737/integrations/celld/upstream/README.md), applies to
public celld 0.6.3 at `8702f6d186c77698dbfb30cf29e3b1922a88f008`. It keeps celld's coordinator
and its default Docker implementation, and adds a Hermitbox public-API implementation beside them.
Select it with `CELLD_CONTAINER_BACKEND=hermitbox`, `HERMITBOX_API_URL` and `HERMITBOX_API_KEY`;
the patch's README has the full set of settings.

What it supports, and what it refuses:

- **One node.** The backend supports celld's single-node development store. Distributed ownership
  is refused until a remote fencing protocol is designed and proven.
- **The host decides isolation.** Local runtime and DNS overrides, root signals and exec are
  explicitly unsupported operations.
- **No duplicate compute.** Creation is sent once, with its key durably recorded first, and an
  uncertain reply blocks replacement. Existing remote compute must be deleted and absent before a
  replacement starts.
- **The project key stays private.** It lives only in the service's environment and memory.
- **Images come from a permitted registry.** In production, images must already be available
  through a permitted registry reference; local CI shares the development image store.

## Native comparison

Through Hermitbox, celld's backend starts more slowly (215 ms against 142 ms at p50), and a warm
HTTP response takes 1.52 ms longer at p90. Start through first response is lower, for
reasons explained under the table.

CI measures 30 starts and first HTTP requests for each engine on the same host, from the same
patched celld 0.6.3 executable, built with the development profile with debug information and
incremental compilation turned off. The Worker, Python server, Dockerfile and class configuration
are unchanged from the public release. Each cell's cleanup is outside its timer.

On one two-core Intel Xeon Platinum 8370C host running Linux 7.0.0-1017-azure, with n=30 for every
row and backend (p50 is the sorted upper median, p90 the nearest-rank observation):

| Operation | Local engine p50 / p90 ms | Native Hermitbox p50 / p90 ms |
| --- | --- | --- |
| backend start | 142.00 / 154.00 | 215.00 / 233.00 |
| start through first HTTP response | 1881.78 / 1889.72 | 1274.87 / 1284.34 |
| warm HTTP response | 5.50 / 5.72 | 5.74 / 7.24 |

The native backend adds 79 ms to backend-start p90 and 1.52 ms to warm-response p90 on this host.
Its start-through-first-response time is lower, but that includes celld's own readiness and
polling sequence, and we don't attribute it to an isolated transport or kernel optimization. These
figures hold for this host only.

## Docker socket experiment

The separate [Unix socket spike](https://github.com/hermitbox/hermitbox/blob/cdd62e6c07e07c2b649b726729b4d8da6b25a737/integrations/celld/src/docker-api-spike.ts) is unshipped: it
is absent from node features and package exports. It implements `_ping` and `version` discovery,
using API version facts read from the baseline engine, and answers 501 to every operation it
doesn't support. It does not import arbitrary image tars, start privileged fence containers or
relax host policy.

celld's engine builds and loads images and installs a privileged host-network fence. Those
operations have no public sandbox API equivalent, and a Unix listener alone can't make that engine
compatible safely.

CI runs the unchanged release and its own example with `DOCKER_HOST` pointed at the private
mode-0600 socket. Discovery passes. The release then fails to build its example image, because
BuildKit's POST `/grpc` and its buildkit-container inspection get explicit 501 replies, and it
exits 1. This route has no start or first-request samples, and no `docker-api` node feature is
advertised.

## How this is tested

CI builds the patched public source and runs celld's own container example through both its
local engine and the native Hermitbox backend; all 30 samples complete for both engines. CI keeps
every sample, failed cohorts included, in `celld-native-measurements.json`.

The socket experiment's requests, exit status and output are kept in `docker-api-spike.json`.
