Skip to content

fix(inspect): support -f flag and {{.State.Running}} format#2

Merged
benjipeng merged 1 commit into
appautomaton:mainfrom
gostop54:fix/inspect-format-short-and-state-running
Jul 15, 2026
Merged

fix(inspect): support -f flag and {{.State.Running}} format#2
benjipeng merged 1 commit into
appautomaton:mainfrom
gostop54:fix/inspect-format-short-and-state-running

Conversation

@gostop54

@gostop54 gostop54 commented Jul 9, 2026

Copy link
Copy Markdown
Contributor

Summary

Fixes two Docker CLI compatibility gaps in docker inspect:

  1. Accept -f as alias for --format — Docker supports both, but the shim only accepted --format
  2. Support {{.State.Running}} Go template — returns true/false based on container state

Motivation

OpenClaw (and likely other Docker-dependent tools) uses these patterns to check sandbox container state:

docker inspect -f '{{.State.Running}}' <container>

Without this fix, the shim rejects the -f flag entirely, causing container state detection to fail and tools to attempt duplicate container creation.

Changes

  • cmd_inspect: -f now treated identically to --format
  • cmd_inspect: {{.State.Running}} format renders true when container state is "running", false otherwise

Test

docker inspect -f '{{.State.Running}}' <container>
# => true

docker inspect --format '{{.State.Running}}' <stopped-container>
# => false

- Accept -f as alias for --format in docker inspect (Docker CLI compatibility)
- Add {{.State.Running}} Go template to return container running state

Fixes compatibility with OpenClaw sandbox which uses these patterns
to check container state before reusing sandbox containers.

@benjipeng benjipeng left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you for the contribution. This fixes an important Docker inspect compatibility gap for OpenClaw. We will add broader inspect support in follow-up work.

@benjipeng benjipeng merged commit 6905030 into appautomaton:main Jul 15, 2026
@benjipeng

Copy link
Copy Markdown
Contributor

Thanks again for the contribution. We expanded the inspect support into a broader generic implementation, and it is now available in v0.1.3.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants