fix(inspect): report the applied memory limit in HostConfig - #90
Merged
Conversation
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.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
The memory limit set via
mocker run -m(or composemem_limit/deploy.resources.limits.memory) was applied by the runtime but never surfaced inmocker inspect:HostConfigwas omitted from the inspect DTO, somocker 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
ContainerInfogainsmemoryBytes— parsed indecodeInspectfrom the value the Apple CLI already reports (configuration.resources.memoryInBytes).ContainerInspectgains a Docker-shapedHostConfig(Memoryint64,0when no limit;NetworkMode"default"), populated inmapToContainerInspect.mocker inspectand the Docker API inspect endpoint now exposeHostConfig.Memory.Verified
decodeInspectparsesresources.memoryInBytesand returns nil without it.mapToContainerInspectmaps the limit toHostConfig.Memory(0 when none).HostConfig.Memory/HostConfig.NetworkMode).mocker run -m 4G ...thenmocker inspect --format '{{.HostConfig.Memory}}'→4294967296(previously empty).💘 Generated with Crush