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.
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. 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. All state is tracked in config.yaml, and workers run in isolated sandboxes managed by the engine.