The Kaisar Node image runs the same kaisar command as on a server. It has no shell and runs as an unprivileged user (UID 65532). The Docker image is coming later; until then <image> below is a placeholder, and <gateway> is the node gateway address [TBA].
What every container needs
- The host machine ID, read-only. A container has no machine ID of its own, so linking is refused without it (error KN-1005). All containers on one host share its machine ID, so one host runs one node.
- A volume for the node data. The node key is created inside the container on first link and stored as a file in
/home/nonroot/.config/kaisar-node. Without a volume there, the key is lost when the container is removed. - 30 seconds to stop.
docker stopwaits 10 seconds by default; Kaisar Node needs up to 25 seconds to hand back held tasks.
Docker
- Create the volume once:
docker volume create kaisar-node-data- Get a 6-digit code in Kaisar App › Node Hub › Add node, then link. Confirm in the App within 10 minutes:
docker run --rm -it -e KAISAR_GATEWAY_URL=<gateway> \
-v /etc/machine-id:/etc/machine-id:ro \
-v kaisar-node-data:/home/nonroot/.config/kaisar-node \
<image> link <code>- Start the node in the background:
docker run -d --name kaisar-node --stop-timeout 30 --restart unless-stopped \
--read-only --cap-drop ALL --security-opt no-new-privileges \
-e KAISAR_GATEWAY_URL=<gateway> \
-v /etc/machine-id:/etc/machine-id:ro \
-v kaisar-node-data:/home/nonroot/.config/kaisar-node \
<image> run- Follow the log:
docker logs -f kaisar-nodeThe image already starts kaisar, so pass only the command (link, run, whoami, doctor). To stop: docker stop -t 30 kaisar-node.
- Check the health status. It shows
healthyabout a minute after the start:
docker inspect --format '{{.State.Health.Status}}' kaisar-nodeHealth check
The image has a built-in health check: kaisar healthcheck every 60 seconds. kaisar run writes a small status file to the data volume every 15 seconds; the container is unhealthy when the node has not reported for over 2 minutes (error KN-3006). The file holds only the time and two flags, no key and no node ID. It needs no shell, no open port and no network.
Docker only marks the container; it does not restart an unhealthy container on its own. One-off containers (link, doctor) show unhealthy: that is expected.
To check a machine in a running setup:
docker run --rm -e KAISAR_GATEWAY_URL=<gateway> \
-v /etc/machine-id:/etc/machine-id:ro \
-v kaisar-node-data:/home/nonroot/.config/kaisar-node \
<image> doctorDocker Compose
- Save this as
docker-compose.yml:
services:
kaisar-node:
image: <image>
command: [run]
environment:
KAISAR_GATEWAY_URL: ${KAISAR_GATEWAY_URL:?node gateway URL}
volumes:
- /etc/machine-id:/etc/machine-id:ro
- kaisar-node-data:/home/nonroot/.config/kaisar-node
restart: unless-stopped
stop_grace_period: 30s
healthcheck:
test: ["CMD", "/usr/local/bin/kaisar", "healthcheck"]
interval: 60s
timeout: 10s
start_period: 60s
retries: 3
read_only: true
cap_drop: [ALL]
security_opt:
- no-new-privileges:true
volumes:
kaisar-node-data: {}- Link once with the code from Kaisar App, then confirm in the App:
KAISAR_GATEWAY_URL=<gateway> docker compose run --rm kaisar-node link <code>- Start the node:
KAISAR_GATEWAY_URL=<gateway> docker compose up -dThe key stays in the volume, so restarting the container or the host needs no new code. docker compose ps shows the health status.
Update
- Get the new image:
docker pull <image>:<version>and set that tag in yourdocker runcommand ordocker-compose.yml. - Recreate the container. Docker:
docker stop -t 30 kaisar-node && docker rm kaisar-node, then thedocker run -d …command from step 3 above. Compose:docker compose up -d. - Check:
docker compose run --rm kaisar-node doctor(or thedocker run … doctorcommand above).
The key stays in the volume: no new code is needed.
The node key in a container
- In a container Kaisar Node always keeps the key in a file (0600) in a private folder (0700). Do not turn off seccomp or add capabilities for it.
- A named volume gets the right owner and permissions from the image. With a bind mount, run
chown 65532:65532andchmod 700on the host folder first; looser permissions are refused (error KN-1105). - Anyone with root access to the host can read the volume. Use an encrypted disk and do not back the volume up off the machine.
- Removing the volume removes the key: remove the machine in Kaisar App › Node Hub, then link again.
Machine ID
- If the image has its own
/var/lib/dbus/machine-idfile, mount the host machine ID there too. - A machine ID built into an image is refused, because everyone who runs that image would share it.
- A cloned virtual machine keeps the same machine ID and is treated as the same machine (error KN-2201). Create a new one on the host:
sudo rm /etc/machine-id && sudo systemd-machine-id-setup, then restart.
Metrics in Docker: see Metrics and health checks.