anakot-s6-container-supervision

Modify and debug the s6-overlay supervision tree inside the Anakot Agent Docker image.

Updated Jun 7, 2026
One-click install
npx skills add https://github.com/Chensihakniroth/ANAKOT-AGENT --skill anakot-s6-container-supervision-chensihakniroth
Or copy as Structured Prompt for Agent▼
Please help me install this Agent Skill.
Skill: anakot-s6-container-supervision
Source: https://github.com/Chensihakniroth/ANAKOT-AGENT/tree/main/optional-skills/devops/anakot-s6-container-supervision
Command: npx skills add https://github.com/Chensihakniroth/ANAKOT-AGENT --skill anakot-s6-container-supervision-chensihakniroth

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve? Working on the Anakot Agent Docker image's s6-overlay supervision tree is error-prone: services fail to start, per-profile gateways crash-loop after docker restart, and the container exit code behaves unexpectedly. This Skill provides the architectural context, file map, and operational recipes needed to safely modify, debug, or extend the supervision setup. ## Core Features & Use Cases - Architecture Reference: Explains the Architecture B pattern where the container CMD (main-wrapper.sh) runs as the main program under /init, why s6-supervised main was abandoned, and how cont-init.d, s6-rc.d, and /run/service interact. - Service Management Recipes: Step-by-step instructions for adding new static s6-rc services, changing per-profile gateway run scripts via S6ServiceManager._render_run_script, and manually controlling services with s6-svc. - Troubleshooting Playbook: Diagnoses common failures such as command not found via docker exec, root-owned profile directories breaking the reconciler, crash-looping gateways, and containers exiting 143. - Use Case: A developer adds a new supervised service to the Docker image: create the s6-rc.d/<name> directory with type/run files, wire it into the user bundle, and verify with the docker test harness expecting 19 passed tests. ## Quick Start Ask the agent to explain why a per-profile gateway is not surviving docker restart and show how to inspect its s6 service state.

Frequently Asked Questions about anakot-s6-container-supervision

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I add a new supervised service to an s6-overlay Docker image?▼

Create a `docker/s6-rc.d/<name>/` directory with a `type` file containing `longrun` and a `run` script using `#!/command/with-contenv sh`. Add empty `dependencies.d/base` and `user/contents.d/<name>` files so it joins the user bundle, and the Dockerfile COPY picks it up automatically.

Why does docker exec say s6-svstat command not found?▼

The `/command/` directory containing s6-overlay binaries is only on PATH for processes spawned by the supervision tree, not for `docker exec` sessions. Always use the absolute path, for example `docker exec <c> /command/s6-svstat /run/service/gateway-<name>`.

Why does my s6-overlay container always exit with code 143?▼

Invoking `s6-svscanctl -t` or `/run/s6/basedir/bin/halt` triggers stage 3 shutdown but returns 143 (SIGTERM) instead of your exit code. To get a real exit code, let the container CMD exit normally rather than controlling shutdown from a finish script.

Why does a per-profile gateway keep crash-looping after docker restart?▼

A `down (exitcode 1)` state in s6-svstat usually means the profile has no model or auth configured, so the gateway exits immediately while s6 keeps restarting it. Run `anakot -p <profile> setup` first; the next supervised attempt will stay up once configured.

How does the container restore profile gateways after a restart?▼

The cont-init.d script `02-reconcile-profiles` runs `anakot_cli.container_boot`, which walks `$ANAKOT_HOME/profiles/<name>/gateway_state.json`, recreates `/run/service/gateway-<name>/` slots on tmpfs, and auto-starts only profiles whose prior state was running.

When should I not run the main program as an s6-supervised service?▼

Avoid it when cont-init.d scripts need CMD arguments, since they receive none, and when you need the container exit code propagated, since s6 halt always returns 143. The CMD-as-main-program pattern preserves the pre-s6 tini exit contract.