Skip to content

docker: add lsof to runtime image - #46636

Merged
vincentkoc merged 2 commits into
mainfrom
vincentkoc-code/browser-docker-force-tooling
Mar 15, 2026
Merged

vincentkoc merged 2 commits into
mainfrom
vincentkoc-code/browser-docker-force-tooling

Conversation

@vincentkoc

Copy link
Copy Markdown
Member

Summary

  • Problem: openclaw gateway run --force can fail inside the runtime Docker image because neither lsof nor fuser is installed.
  • Why it matters: browser and gateway smoke flows in containers use --force, so the runtime image should support the same operational path it documents.
  • What changed: install lsof in the runtime image so the existing src/cli/ports.ts logic works unchanged.
  • What did NOT change (scope boundary): no gateway CLI semantics, no browser behavior, no new smoke coverage in this PR.

Change Type (select all)

  • Bug fix
  • Feature
  • Refactor
  • Docs
  • Security hardening
  • Chore/infra

Scope (select all touched areas)

  • Gateway / orchestration
  • Skills / tool execution
  • Auth / tokens
  • Memory / storage
  • Integrations
  • API / contracts
  • UI / DX
  • CI/CD / infra

Linked Issue/PR

User-visible / Behavior Changes

  • The runtime Docker image now includes lsof, so openclaw gateway run --force works in containerized runtime flows.

Security Impact (required)

  • New permissions/capabilities? (Yes/No): No
  • Secrets/tokens handling changed? (Yes/No): No
  • New/changed network calls? (Yes/No): No
  • Command/tool execution surface changed? (Yes/No): No
  • Data access scope changed? (Yes/No): No
  • If any Yes, explain risk + mitigation:

Repro + Verification

Environment

  • OS: macOS host, Debian bookworm runtime image
  • Runtime/container: Docker
  • Model/provider: N/A
  • Integration/channel (if any): N/A
  • Relevant config (redacted): N/A

Steps

  1. Build the runtime image.
  2. Run openclaw gateway run --force inside the container.
  3. Confirm the command no longer fails on missing lsof / fuser.

Expected

  • --force can inspect and clear the target port in the runtime image.

Actual

  • Verified after this change.

Evidence

  • Failing test/log before + passing after
  • Trace/log snippets
  • Screenshot/recording
  • Perf numbers (if relevant)

Human Verification (required)

What you personally verified (not just CI), and how:

  • Verified scenarios: runtime Docker image build plus openclaw gateway run --force as part of the Docker browser MCP smoke flow.
  • Edge cases checked: no CLI logic changes; only the runtime package set changed.
  • What you did not verify: non-Debian runtime variants outside this Dockerfile.

Review Conversations

  • I replied to or resolved every bot review conversation I addressed in this PR.
  • I left unresolved only the conversations that still need reviewer or maintainer judgment.

Compatibility / Migration

  • Backward compatible? (Yes/No): Yes
  • Config/env changes? (Yes/No): No
  • Migration needed? (Yes/No): No
  • If yes, exact upgrade steps:

Failure Recovery (if this breaks)

  • How to disable/revert this change quickly: revert this PR or rebuild the image from the previous commit.
  • Files/config to restore: Dockerfile
  • Known bad symptoms reviewers should watch for: unexpected runtime image size/package drift only.

Risks and Mitigations

  • Risk: slight runtime image size increase.
    • Mitigation: only one small package added; no logic changes.

@openclaw-barnacle openclaw-barnacle Bot added the docker Docker and sandbox tooling label Mar 14, 2026
@vincentkoc vincentkoc self-assigned this Mar 14, 2026
@openclaw-barnacle openclaw-barnacle Bot added size: XS maintainer Maintainer-authored PR labels Mar 14, 2026
@vincentkoc
vincentkoc marked this pull request as ready for review March 15, 2026 02:40
@vincentkoc
vincentkoc merged commit 8aaafa0 into main Mar 15, 2026
10 checks passed
@vincentkoc
vincentkoc deleted the vincentkoc-code/browser-docker-force-tooling branch March 15, 2026 02:40
@greptile-apps

greptile-apps Bot commented Mar 15, 2026

Copy link
Copy Markdown
Contributor

Greptile Summary

This PR adds lsof to the runtime Docker image's package list so that openclaw gateway run --force works correctly in containerized deployments. The change is minimal and well-scoped: a single package added to an existing apt-get install call that applies to both the default (bookworm) and slim (bookworm-slim) runtime variants.

  • lsof is the primary tool used by src/cli/ports.ts to inspect listening TCP ports before forcefully clearing them; fuser is only a fallback.
  • Without lsof (and fuser) installed, the --force path raises a hard error (ENOENT), making the runtime image unable to follow the operational flow documented for it.
  • The fix is isolated to the Dockerfile; no CLI logic, gateway semantics, or test coverage is changed.
  • Both runtime variants (base-default and base-slim) receive lsof because the affected RUN layer runs after the FROM base-${OPENCLAW_VARIANT} selector.
  • Minor: the existing package list is not alphabetically sorted, and lsof is inserted between git and openssl, which is consistent with the pre-existing ordering style.

Confidence Score: 5/5

  • This PR is safe to merge — a single well-justified package addition with no logic, security, or compatibility risk.
  • The change is a single-line addition of a well-known, stable OS package to a pinned Debian apt-get install call. It does not touch any application logic, introduces no new network calls or permissions, and is fully backward compatible. The need for lsof is clearly evidenced by src/cli/ports.ts, which hard-errors on ENOENT when the binary is absent and --force is requested.
  • No files require special attention.

Last reviewed commit: 1772757

frankekn pushed a commit to thepagent/openclaw that referenced this pull request Mar 15, 2026
sibbl pushed a commit to sibbl/clawdbot that referenced this pull request Mar 15, 2026
romeroej2 pushed a commit to romeroej2/openclaw that referenced this pull request Mar 16, 2026
sbezludny pushed a commit to sbezludny/openclaw that referenced this pull request Mar 27, 2026
alexey-pelykh pushed a commit to remoteclaw/remoteclaw that referenced this pull request Mar 27, 2026
alexey-pelykh pushed a commit to remoteclaw/remoteclaw that referenced this pull request Mar 27, 2026
lovewanwan pushed a commit to lovewanwan/openclaw that referenced this pull request Apr 28, 2026
ogt-redknie pushed a commit to ogt-redknie/OPENX that referenced this pull request May 2, 2026
github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request May 24, 2026
Nachx639 pushed a commit to Nachx639/clawdbot that referenced this pull request Jun 17, 2026
vixco pushed a commit to vixco/openclaw that referenced this pull request Aug 16, 2026
globalcaos pushed a commit to globalcaos/tinkerclaw that referenced this pull request Sep 29, 2026
lhfer pushed a commit to lhfer/openclaw that referenced this pull request Oct 11, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

docker Docker and sandbox tooling maintainer Maintainer-authored PR size: XS

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant