Documentation Index
Fetch the complete documentation index at: https://motiadev-chore-content-updates-2.mintlify.app/llms.txt
Use this file to discover all available pages before exploring further.
Goal
Use theiii worker commands to manage container workers throughout their lifecycle — from adding an image to monitoring logs and removing workers you no longer need.
Context
Container workers are OCI images that the engine pulls, extracts, and runs in isolated sandboxes. Theiii worker CLI manages these workers declaratively through config.yaml, so you rarely need to edit configuration files by hand. Registry-managed workers can also be pinned in iii.lock for reproducible installs.
Steps
1. Add a Worker
Pull an image from a registry and register it inconfig.yaml:
config.yaml:
config.yaml
/iii/worker.yaml manifest with resources hints, they are included automatically.
Once defined in config.yaml, all workers start automatically when you run iii. If you make changes to the workers list, simply restart iii to pick them up — no extra commands needed.
2. Configure Environment and Resources
Editconfig.yaml to pass environment variables or set resource limits:
config.yaml
config: are flattened and injected as environment variables when the worker starts. Changes take effect the next time the worker starts (restart iii to apply).
3. Remove a Worker
Remove a worker and its entry fromconfig.yaml:
4. Manage Individual Workers (Optional)
If you need fine-grained control over workers whileiii is already running, the CLI provides commands to manage them individually. These are optional — restarting iii always starts every worker defined in config.yaml.
5. Exec into a Running Worker
Run a command inside a running worker’s microVM — useful for debugging crashed handlers, inspecting guest filesystem state, running ad-hoc scripts, or opening an interactive shell. Behaves likedocker exec: stdin/stdout/stderr flow through, the child’s exit code becomes the CLI’s exit code.
When both stdin and stdout are terminals,
iii worker exec automatically allocates a pseudo-terminal — line editing, job control, and prompts all work. The moment either stream is redirected or piped (... -- cmd | tee log, ... -- cmd > out.txt, CI), pipe mode kicks back in so output stays byte-exact. Pass -t to force TTY, or --no-tty to force pipe mode in a terminal.Ctrl-C once to send SIGINT to the guest process; press it again within a second to escalate to SIGKILL and exit. --timeout accepts humantime syntax (30s, 5m, 1500ms); on expiry the client kills the guest session and exits with code 124, matching coreutils timeout(1).
Flags:
| Flag | Purpose |
|---|---|
-e KEY=VALUE | Set an env var in the spawned process. Repeatable. |
-w PATH | Working directory inside the guest. Defaults to /workspace. |
-t, --tty | Force TTY mode (required if stdin isn’t a terminal and you want one anyway). |
--no-tty | Force pipe mode, disabling auto-detection. |
--timeout DURATION | SIGKILL the child after DURATION; exit 124. |
6. Build and Publish Your Own Image
To distribute a custom worker as an OCI image, create a project that uses an iii SDK, package it with a Dockerfile, and push it to a registry.Write the Worker
- Node.js / TypeScript
- Python
- Rust
src/index.ts
Create a Dockerfile
The image must define anENTRYPOINT that starts the worker process. It should also declare ENV variables to configure how the worker connects to the engine.
When you run iii worker add, the CLI extracts all ENV declarations from the OCI image and writes them as the config: block in config.yaml. This is how the image communicates its default configuration to the engine.
For binary workers (e.g. Rust), also set CMD with --url so the runtime can patch the engine address at startup.
- Node.js / TypeScript
- Python
- Rust
Dockerfile
Running
iii worker add extracts all ENV declarations from the image (excluding system variables like PATH and HOME) and writes them under config: in config.yaml. You can then edit config.yaml to override any value. At startup, the runtime reads III_ENGINE_URL (or III_URL) from config: and uses it to connect the worker to the engine.Build and Push
Result
You can manage the full lifecycle of container workers — add, configure, start, stop, inspect logs, and remove — using theiii worker CLI. Worker configuration is tracked in config.yaml; registry-managed worker source pins can also be tracked in iii.lock. See Reproduce Worker Installs for the lockfile workflow.