# Deploy the release image

> Let your agent do it: Run the Hermitbox release image on this container host. Start it with `docker run`, publishing port 8080 and keeping a named volume at `/var/lib/hermitbox`, as the page shows. Have me read the initial API key from the container's log on its first start, then set `HERMITBOX_API_URL=http://localhost:8080` and `HERMITBOX_API_KEY` in the shell's private environment, never in a file or this chat. Run `hermitbox run -- echo hello` and `hermitbox doctor`, and show me the output. Follow the exact steps in https://docs.hermitbox.dev/v0.2.4/hosting/container.md.

Run the all-in-one Hermitbox release image with Docker or any container host.

<!-- SPDX-License-Identifier: AGPL-3.0-only -->
# Deploy the release image

Run the all-in-one Hermitbox release image with Docker or any container host. The image bundles
control, edge, the node daemon, embedded Postgres and an S3-compatible store.

```sh
docker run -p 8080:8080 ghcr.io/hermitbox/hermitbox:0.2.4
```

## First start

Open the public root address for the welcome page and caller examples. If
`HERMITBOX_BOOTSTRAP_API_KEY` is set, it supplies the first key and is never logged. Otherwise the
first successful start prints the initial API key once.

Set `HERMITBOX_API_URL` to `http://localhost:8080` and `HERMITBOX_API_KEY` to that key in the CLI
or SDK environment, then run a command with the bundled userland:

```sh
hermitbox run -- echo hello
```

`hermitbox run --image alpine:3.22 -- echo hello` is refused on the process tier, with the image
error in [process tier](https://docs.hermitbox.dev/v0.2.4/reference/process-tier.md). See [hosting](https://docs.hermitbox.dev/v0.2.4/hosting.md) for platform files
and exact validation boundaries.

## Tiers in the image

The image serves process and agentOS VMs together where their probes succeed, and container
workloads where the host engine is usable. Control chooses an eligible tier for a request that
names none, and reports the result.

A request with `isolation` fixes its tier, and a missing runtime is refused by name.
`hermitbox doctor` lists what this host supports and why a tier is off. Priority and
single-backend overrides are in [tiers](https://docs.hermitbox.dev/v0.2.4/reference/tiers.md).

Wasm refuses an image and accepts optional `packages` registry names instead. See
[tiers](https://docs.hermitbox.dev/v0.2.4/reference/tiers.md) for the measured default and capabilities, and
[agentOS](https://docs.hermitbox.dev/v0.2.4/integrations/agentos.md) for persistence and ingress limits.

The process tier is Linux-only and requires the kernel policy in
[process tier](https://docs.hermitbox.dev/v0.2.4/reference/process-tier.md). The image fails closed when the platform can't
enforce it.

Container-tier installations add a usable host Docker socket and the host firewall policy. They
need an operator's host permissions and don't change the ordinary-container process proof. The
[one-command installer](https://docs.hermitbox.dev/v0.2.4/get-started/install.md) runs the same supervisor as an ordinary user,
or provisions a systemd server as root.

## Storage and Compose

Docker creates the image's state volume automatically. For a named persistent volume:

```sh
docker run \
  --name hermitbox \
  -p 8080:8080 \
  -v hermitbox:/var/lib/hermitbox \
  ghcr.io/hermitbox/hermitbox:0.2.4
```

`docker compose up --build` uses the root [docker-compose.yml](https://github.com/hermitbox/hermitbox/blob/c61777fdb140d97cded5ef039bce3a7e7c7a2a18/docker-compose.yml) with a
named state volume. `docker compose logs hermitbox` shows the initial key on first start.

A fresh image can run with `--user 1000:1000`. It then reports shared UID isolation and keeps that
user's state in its own directory in the volume. Restart with the same UID and volume.

The process tier needs no privileged flag, engine socket or seccomp override. Embedded Postgres
requires its private password on both TCP and Unix sockets.

## Network and public URLs

The only public listener is HTTP port `8080`, or `PORT`. Set `HERMITBOX_PUBLIC_URL` to the
externally reachable HTTP or HTTPS origin behind your platform's TLS terminator.

Agent URLs use an authenticated `/sandboxes/<sandbox-id>/_hermitbox/` alias. Exposed application
ports use public `/sandboxes/<sandbox-id>/ports/<port>/` aliases. Applications behind those
aliases must support their URL prefix.

Declared HTTP ports use the public hostnames the API returns. Configure DNS, and preserve the Host
header through the TLS terminator. The `HERMITBOX_PUBLIC_URL` hostname stays reserved for control
routing, even when a declared hostname collides with it.

TLS and raw TCP fronts are off in the image. Standalone host edges can still use wildcard DNS,
certificates and raw fronts, as [sandbox agent](https://docs.hermitbox.dev/v0.2.4/reference/sandbox-agent.md) documents.

New image state derives its private node listener pool below the kernel's outgoing ephemeral
range, without changing sysctls. A restart keeps the stored pool, including older implicit pools.

The image honours the edge's `HERMITBOX_EDGE_*` admission and greeting settings and keeps embedded
service listeners private. Normal limits remain the defaults.

## External Postgres and S3

Without `DATABASE_URL`, the image starts private Postgres in the volume. With `DATABASE_URL`, it
uses that Postgres and applies Hermitbox's migrations.

Without `S3_ENDPOINT`, it starts a private S3-compatible store in the volume. To use external S3,
set `S3_ENDPOINT`, `S3_BUCKET`, `S3_ACCESS_KEY` and `S3_SECRET_KEY` together. Normal TLS
certificate checks stay on.

Keep the state volume even with external stores. It also holds fleet identity, private
credentials and local sandbox data. Back up the database, object store and state together.

## Managed platforms

Render builds this image from the repository Dockerfile with the root
[render.yaml](https://github.com/hermitbox/hermitbox/blob/c61777fdb140d97cded5ef039bce3a7e7c7a2a18/render.yaml) Blueprint: an ordinary Docker web service, a persistent state disk
and managed Postgres. [Host on Render](https://docs.hermitbox.dev/v0.2.4/hosting/render.md) has the steps. Every other platform is in
[hosting](https://docs.hermitbox.dev/v0.2.4/hosting.md).

## Run under systemd

On a fresh Linux host, `sudo hermitbox up --image --domain sandboxes.example.com` installs the
same release image as a systemd service. It pulls, copies from and runs that image only by the
index digest in the release's signed server manifest. It refuses a cached image under any other
digest.

An explicit image reference can follow `--image`, or be set in `HERMITBOX_IMAGE`. It is used as
given, and the install output's `imageSource` says which of the two ran. The one-box binary preset
starts PostgreSQL and RustFS by index digest too.

This operator path installs the host Docker and firewall policy and mounts the engine socket. Its
container needs `NET_ADMIN` to apply that policy. It is separate from the ordinary process start
above.

A repeated installation keeps its credentials. Stop an existing binary installation and migrate
its data first; the installer refuses an active binary deployment.

The host installation reserves its configured workload ports in Linux's
`ip_local_reserved_ports`, keeping existing reservations and writing a sysctl drop-in. Outgoing
connections then can't take a stopped sandbox's published port. For an existing manually
installed node, run:

```sh
sudo hermitboxd reserve-ports --config /etc/hermitboxd/hermitboxd.toml
```
