docker setup/init for openclaw gateway
209
secretvm/openclaw-init is a minimal one-shot initialization container used to prepare the filesystem for an OpenClaw gateway deployment in Docker.
It ensures that required directories exist and are correctly owned by the node user (UID 1000) before the OpenClaw gateway starts.
• Confidential VMs
• Immutable infrastructure
• Automated portal deployments
• Environments where host directories may not exist yet
• Environments where volume permissions may be incorrect
1. Creates required OpenClaw directories:
• /home/node/.openclaw
• /home/node/.openclaw/workspace
2. Recursively sets ownership to: 1000:1000
(the node user inside the OpenClaw container)
3. Optionally tightens directory permissions (700).
4. Exits successfully (exit 0) once setup is complete.
• Start OpenClaw
• Modify configuration files
• Persist background processes
• Run continuously
It is designed to complete and exit.
OpenClaw’s official image runs as a non-root user (node, UID 1000).
• do not exist, or
• are owned by root, or
• have incorrect permissions,
the gateway may fail at startup.
secretvm/openclaw-init eliminates these issues in a deterministic way.
• Deploying OpenClaw into a new VM
• Using bind-mounted host directories
• Running in automated portal environments
• Deploying in Confidential VMs
• You cannot manually mkdir and chown on the host
• You are using Docker named volumes
• You manually created and chowned directories
• You are running OpenClaw locally without strict permissions
services:
openclaw-init:
image: secretvm/openclaw-init:v2026.2.19
environment:
OPENCLAW_CONFIG_DIR_IN_CONTAINER: /home/node/.openclaw
OPENCLAW_WORKSPACE_DIR_IN_CONTAINER: /home/node/.openclaw/workspace
OPENCLAW_UID_GID: "1000:1000"
volumes:
- /opt/openclaw/config:/home/node/.openclaw
- /opt/openclaw/workspace:/home/node/.openclaw/workspace
restart: "no"
openclaw-gateway:
image: secretvm/openclaw-tools:latest
depends_on:
openclaw-init:
condition: service_completed_successfully
volumes:
- /opt/openclaw/config:/home/node/.openclaw
- /opt/openclaw/workspace:/home/node/.openclaw/workspace
command:
[
"node",
"openclaw.mjs",
"gateway",
"--bind",
"lan",
"--port",
"18789"
]
If needed, you can run it directly:
docker run --rm \
-v /opt/openclaw/config:/home/node/.openclaw \
-v /opt/openclaw/workspace:/home/node/.openclaw/workspace \
secretvm/openclaw-init:v2026.2.19
| Variable | Default Description |
|---|---|
| OPENCLAW_CONFIG_DIR_IN_CONTAINER | /home/node/.openclaw Target config directory inside container |
| OPENCLAW_WORKSPACE_DIR_IN_CONTAINER | /home/node/.openclaw/workspace Target workspace directory inside container |
| OPENCLAW_UID_GID | 1000:1000 Ownership applied to directories |
• No network listeners
• No exposed ports
• No background processes
• Runs as root inside container to fix permissions
• Exits immediately after initialization
This makes it safe for use in automated production pipelines.
1. openclaw-init runs.
2. Directories are created and fixed.
3. Container exits successfully.
4. openclaw-gateway starts.
5. Gateway runs as non-root user.
secretvm/openclaw-init is a minimal, deterministic, idempotent filesystem preparation container that ensures OpenClaw can start reliably in production VM deployments.
• Confidential VM environments
• Automated provisioning systems
• Customer-facing portal deployments
Content type
Image
Digest
sha256:db7bdb752…
Size
5.1 MB
Last updated
8 months ago
docker pull secretvm/openclaw-init:v2026.2.19