Implementation:Openclaw Openclaw OnboardCommand Docker
| Knowledge Sources | |
|---|---|
| Domains | Deployment, Docker |
| Last Updated | 2026-02-06 12:00 GMT |
Overview
Concrete tool for running the OpenClaw onboarding wizard provided by the onboardCommand function, with Docker-specific flags for containerized execution.
Description
The onboardCommand function in src/commands/onboard.ts is the entry point for all OpenClaw onboarding flows. It normalizes deprecated auth choices, enforces risk acknowledgement for non-interactive mode, handles optional config resets, and dispatches to either the interactive or non-interactive onboarding runner.
For Docker deployments, two key adaptations apply: the --no-install-daemon flag sets installDaemon: false to skip system daemon installation (the container manages the process lifecycle), and the --non-interactive flag enables fully automated configuration via CLI flags alone. The function delegates to runInteractiveOnboarding or runNonInteractiveOnboarding depending on the nonInteractive option.
Usage
Import and call onboardCommand programmatically, or invoke via the CLI as openclaw onboard. In Docker Compose deployments, the docker-setup.sh script calls it as: docker compose run --rm openclaw-cli onboard --no-install-daemon.
Code Reference
Source Location
- Repository: openclaw
- File:
src/commands/onboard.ts(lines 12-80)
Signature
export async function onboardCommand(
opts: OnboardOptions,
runtime: RuntimeEnv = defaultRuntime,
): Promise<void>
Import
import { onboardCommand } from "../commands/onboard.js";
import type { OnboardOptions } from "../commands/onboard-types.js";
I/O Contract
Inputs
| Name | Type | Required | Description |
|---|---|---|---|
| opts | OnboardOptions |
Yes | Configuration object with onboarding parameters. |
| opts.nonInteractive | boolean |
No | When true, runs fully automated onboarding without TTY prompts. Requires acceptRisk: true.
|
| opts.acceptRisk | boolean |
No | Required for non-interactive mode. Acknowledges security implications. |
| opts.authChoice | AuthChoice |
No | AI provider authentication method (e.g., "token", "setup-token", "openai-codex", "gemini-api-key").
|
| opts.flow | "advanced" | "manual" | No | Onboarding flow type. "manual" is an alias for "advanced".
|
| opts.installDaemon | boolean |
No | When false (via --no-install-daemon), skips system daemon installation. Essential for Docker.
|
| opts.gatewayBind | GatewayBind |
No | Gateway bind mode: "loopback", "lan", "auto", "custom", or "tailnet".
|
| opts.gatewayAuth | GatewayAuthChoice |
No | Gateway authentication type: "token" or "password".
|
| opts.gatewayToken | string |
No | Pre-generated gateway authentication token. |
| opts.workspace | string |
No | Workspace directory path. |
| opts.reset | boolean |
No | When true, clears existing config before onboarding.
|
| opts.skipChannels | boolean |
No | Skip messaging channel setup during onboarding. |
| opts.skipHealth | boolean |
No | Skip the post-onboarding health check. |
| runtime | RuntimeEnv |
No | Runtime environment for logging and process control. Defaults to defaultRuntime.
|
Outputs
| Name | Type | Description |
|---|---|---|
| (return value) | Promise<void> |
Resolves when onboarding completes. Calls runtime.exit(1) on validation errors (deprecated auth choice in non-interactive mode, missing risk acknowledgement).
|
Usage Examples
Basic Usage
import { onboardCommand } from "../commands/onboard.js";
// Interactive Docker onboarding (used by docker-setup.sh)
await onboardCommand({
installDaemon: false,
});
// Non-interactive Docker onboarding for CI/CD
await onboardCommand({
nonInteractive: true,
acceptRisk: true,
authChoice: "token",
tokenProvider: "anthropic",
token: process.env.ANTHROPIC_API_KEY,
gatewayBind: "lan",
gatewayAuth: "token",
gatewayToken: process.env.OPENCLAW_GATEWAY_TOKEN,
installDaemon: false,
skipChannels: true,
skipHealth: true,
});
Docker Compose CLI Invocation
# Interactive onboarding (from docker-setup.sh)
docker compose -f docker-compose.yml run --rm openclaw-cli onboard --no-install-daemon
# Non-interactive onboarding for automated deployments
docker compose -f docker-compose.yml run --rm openclaw-cli onboard \
--non-interactive \
--accept-risk \
--auth-choice token \
--token-provider anthropic \
--token "$ANTHROPIC_API_KEY" \
--gateway-bind lan \
--gateway-auth token \
--gateway-token "$OPENCLAW_GATEWAY_TOKEN" \
--no-install-daemon \
--skip-channels \
--skip-health