scripts/docker/setup.sh and the gateway container, plus build memory tuning. Part of the Docker guide.
Environment variables
Optional variables accepted byscripts/docker/setup.sh (and, for the gateway container, by docker-compose.yml directly):
After changing
.env or Compose environment settings, run docker compose up -d openclaw-gateway to recreate the gateway with the new values. docker compose restart does not apply environment changes.
The official image ships no Homebrew. During onboarding, OpenClaw hides brew-only skill dependency installers in a Linux container without brew; provide those dependencies through a custom image or install manually. Use OPENCLAW_IMAGE_APT_PACKAGES for Debian-packaged dependencies and OPENCLAW_IMAGE_PIP_PACKAGES for Python dependencies (runs python3 -m pip install --break-system-packages at build time, so pin versions and use only indexes you trust).
If Docker reports ResourceExhausted, cannot allocate memory, or aborts during tsdown, increase the Docker builder memory limit or retry with smaller explicit heaps: