openclaw - 💡(How to fix) Fix [Feature]: Add --offline flag to scripts/docker/setup.sh for airgapped re-runs with a pre-loaded image [1 participants]

Official PRs (…)
ON THIS PAGE

Recommended Tools

×6

Utilities matched from this issue’s tags and category — try them while you read without losing context.

GitHub issue graph ai analysis

Paste a GitHub issue URL. We fetch that issue, discover linked issues from bodies/comments/timeline, collect linked pull requests, and produce a structured English report.

The report is written in English Markdown for sharing and archival.

Helpful · Quick feedback

Loading…
GitHub stats
openclaw/openclaw#70443Fetched 2026-04-23 07:24:44
View on GitHub
Comments
0
Participants
1
Timeline
0
Reactions
0
Participants

Add a --offline flag to scripts/docker/setup.sh so operators on airgapped hosts can re-run the full setup routine after transferring the OpenClaw image out-of-band (e.g. via USB or an internal artifact bundle) and loading it with docker load.

Error Message

  • Apply the same skip for the optional sandbox image (openclaw-sandbox:bookworm-slim) and warn, not fail, if it is missing — matching the current non-offline branch's tone.

Root Cause

scripts/docker/setup.sh unconditionally runs docker build or docker pull before anything else. On airgapped, offline-first, or high-compliance hosts the image is transferred out-of-band (USB, signed artifact bundle, internal registry snapshot) and imported with docker load. The image is already present locally, but the script still aborts at the build/pull step because there is no network egress.

Fix Action

Fix / Workaround

  • Affected: operators running OpenClaw in airgapped, offline-first, or high-compliance environments (defense, finance, OT/ICS, classified labs, hospitals with strict egress policies). Also useful for CI pipelines that preload a pinned image and want to re-run setup deterministically without hitting a registry.
  • Severity: blocks re-running setup.sh after the initial install on airgapped hosts. Current workaround is to fork/edit the script on every upgrade.
  • Frequency: every setup re-run on those hosts — configuration changes, token rotation, sandbox reconfiguration, release upgrades.
  • Consequence: script drift across hosts, airgapped deployments falling behind the supported install path, onboarding/sandbox fixes from the online branch not reachable without manual patching.
RAW_BUFFERClick to expand / collapse

Summary

Add a --offline flag to scripts/docker/setup.sh so operators on airgapped hosts can re-run the full setup routine after transferring the OpenClaw image out-of-band (e.g. via USB or an internal artifact bundle) and loading it with docker load.

Problem to solve

scripts/docker/setup.sh unconditionally runs docker build or docker pull before anything else. On airgapped, offline-first, or high-compliance hosts the image is transferred out-of-band (USB, signed artifact bundle, internal registry snapshot) and imported with docker load. The image is already present locally, but the script still aborts at the build/pull step because there is no network egress.

The critical point is that operators in these environments do want to run the rest of the setup routine — they are not trying to bypass it. They need it to:

  • pick up new env-var defaults and validation rules after upgrading the repo,
  • refresh .env via upsert_env so compose stays in sync with the new release,
  • fix data-directory permissions (chown pass) against the refreshed image,
  • re-run onboard and sync_gateway_config for gateway mode/bind/token changes,
  • reapply sandbox compose overlays and config pins.

Today the only options on an airgapped host are forking the script, commenting out the build/pull branch, or skipping setup entirely and running docker compose up by hand — all of which cause drift from the supported install path.

Proposed solution

Add a single explicit opt-in flag, --offline, parsed from $@ at the top of the script. When set:

  • Skip docker build and docker pull.
  • Verify the image exists locally via docker image inspect "$OPENCLAW_IMAGE". If not, fail with a clear message pointing at docker load as the intended way to install it.
  • Apply the same skip for the optional sandbox image (openclaw-sandbox:bookworm-slim) and warn, not fail, if it is missing — matching the current non-offline branch's tone.
  • Leave every other step in the script unchanged: env validation, mount validation, upsert_env, permission fix-up, run_prestart_cli onboard, sync_gateway_config, docker compose up -d, sandbox overlay handling.

Without --offline, the script is byte-for-byte identical to today. The flag is a strict subset-of-behavior change, not a new code path for the default case.

Alternatives considered

  • OPENCLAW_OFFLINE=1 env var instead of a flag. Works, but a CLI flag is easier to spot in shell history and CI logs, and matches the --offline convention already used by npm install --offline, apt-get --no-download, cargo --offline, etc.
  • Skip setup entirely and run docker compose up manually. Bypasses onboarding, loses sandbox overlay generation, skips .env synchronization, drifts further from the supported install path on every upgrade — this is what the feature is trying to avoid.
  • Stand up a private registry inside the airgap. Requires extra infrastructure for organizations whose threat model is explicitly "no inbound artifacts except approved USB drops." Not a fit for one-shot or small-deployment airgapped installs.

Impact

  • Affected: operators running OpenClaw in airgapped, offline-first, or high-compliance environments (defense, finance, OT/ICS, classified labs, hospitals with strict egress policies). Also useful for CI pipelines that preload a pinned image and want to re-run setup deterministically without hitting a registry.
  • Severity: blocks re-running setup.sh after the initial install on airgapped hosts. Current workaround is to fork/edit the script on every upgrade.
  • Frequency: every setup re-run on those hosts — configuration changes, token rotation, sandbox reconfiguration, release upgrades.
  • Consequence: script drift across hosts, airgapped deployments falling behind the supported install path, onboarding/sandbox fixes from the online branch not reachable without manual patching.

Evidence/examples

  • Diff against main is ~12 lines of pure shell, fully guarded behind the explicit flag.
  • Prior-art convention in npm install --offline, cargo --offline, apt-get --no-download, and ongoing docker compose offline discussions.
  • Before/after transcripts on an airgapped VM (image loaded via docker load, setup re-run on a config change) can be provided on request.

Additional information

  • Backward compatibility: fully backward-compatible. No new env vars, no config-key changes, no behavior change when --offline is not passed.
  • Security surface: unchanged or smaller. The flag only skips network calls (docker pull) and the build step. It does not add mounts, capabilities, tokens, or network calls.
  • Cross-platform: pure bash arg parse; nothing beyond what the script already uses.
  • Scope boundary: --offline only. Keeping this separate from PR #69143 / issue #69314 (OPENCLAW_DOCKER_PLATFORM) per CONTRIBUTING.md's "one thing per PR" rule — even though both touch scripts/docker/setup.sh.
  • Follow-up PR: will be AI-assisted and marked as such in title/body per the AI/Vibe-Coded PRs section of CONTRIBUTING.md, with prompts/session log available on request, lightly tested locally on a Docker Desktop host that simulates the airgap by dropping network egress on the setup shell.

extent analysis

TL;DR

Add an --offline flag to scripts/docker/setup.sh to allow operators on airgapped hosts to re-run the setup routine without attempting to pull or build the image.

Guidance

  • Add a check at the top of scripts/docker/setup.sh to parse the --offline flag from command-line arguments.
  • If the --offline flag is set, skip the docker build and docker pull steps, and verify the image exists locally using docker image inspect.
  • If the image is missing, fail with a clear message pointing to docker load as the intended installation method.
  • Leave all other steps in the script unchanged to maintain consistency with the default behavior.

Example

if [ "$1" = "--offline" ]; then
  # Skip build and pull steps
  # Verify image exists locally
  if ! docker image inspect "$OPENCLAW_IMAGE" &> /dev/null; then
    echo "Error: Image $OPENCLAW_IMAGE not found. Please load it using 'docker load'." >&2
    exit 1
  fi
fi

Notes

This solution assumes that the --offline flag is the only change needed to support airgapped hosts. It does not introduce any new security risks, as it only skips network calls and build steps.

Recommendation

Apply the workaround by adding the --offline flag to scripts/docker/setup.sh, as it provides a straightforward solution for operators on airgapped hosts to re-run the setup routine without modifying the script or relying on workarounds like forking or commenting out code.

Vote matrix · Quick signals

Works
Did the solution work? Tap to confirm.
Easy Fix
Was it a quick fix?
Time Saver
Did it save you time?
Blocking
Was it severely blocking?
Common Issue
Are others likely hitting this too?
Flaky / Intermittent
Is it intermittent?
Verified / Reproducible
Can you reproduce it reliably?
Loading…

Still need to ship something?

×6

Another batch ranked right after the header list — different links, same matching logic.

Back to top recommendations

TRENDING

openclaw - 💡(How to fix) Fix [Feature]: Add --offline flag to scripts/docker/setup.sh for airgapped re-runs with a pre-loaded image [1 participants]