Skip to content

fix(inspect): report the applied memory limit in HostConfig - #90

Merged
us merged 1 commit into
us:mainfrom
itxtoledo:fix/inspect-report-memory-limit
Aug 25, 2026
Merged

fix(inspect): report the applied memory limit in HostConfig#90
us merged 1 commit into
us:mainfrom
itxtoledo:fix/inspect-report-memory-limit

Conversation

@itxtoledo

Copy link
Copy Markdown
Contributor

The memory limit set via mocker run -m (or compose mem_limit/deploy.resources.limits.memory) was applied by the runtime but never surfaced in mocker inspect: HostConfig was omitted from the inspect DTO, so mocker inspect --format '{{.HostConfig.Memory}}' (and the Docker API inspect endpoint) always returned empty — making it look like the limit was not applied (e.g. debugging a TigerBeetle container that hangs without its 4G limit).

Change

  • ContainerInfo gains memoryBytes — parsed in decodeInspect from the value the Apple CLI already reports (configuration.resources.memoryInBytes).
  • ContainerInspect gains a Docker-shaped HostConfig (Memory int64, 0 when no limit; NetworkMode "default"), populated in mapToContainerInspect.
  • Both mocker inspect and the Docker API inspect endpoint now expose HostConfig.Memory.

Verified

  • 458/458 Swift tests pass, including new coverage:
    • decodeInspect parses resources.memoryInBytes and returns nil without it.
    • mapToContainerInspect maps the limit to HostConfig.Memory (0 when none).
    • JSON shape uses Docker PascalCase keys (HostConfig.Memory / HostConfig.NetworkMode).
  • End-to-end: mocker run -m 4G ... then mocker inspect --format '{{.HostConfig.Memory}}'4294967296 (previously empty).

💘 Generated with Crush

The memory limit set with --memory (run or compose mem_limit/deploy)
was applied by the runtime but never surfaced in `mocker inspect`:
HostConfig was omitted entirely, so `--format '{{.HostConfig.Memory}}'`
always came back empty even when the limit was in effect.

Parse the limit the Apple CLI already reports
(configuration.resources.memoryInBytes) into ContainerInfo, add a
Docker-shaped HostConfig (Memory int64, 0 when no limit; NetworkMode
"default") to the inspect DTO, and map it in mapToContainerInspect.
Both `mocker inspect` and the Docker API inspect endpoint now expose
HostConfig.Memory.
@us
us merged commit cf68e47 into us:main Aug 25, 2026
1 check passed
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.

2 participants