Repository navigation
fix(docker): set model container CPU limits through the provider's cpus - #14491
Merged
Merged
Conversation
Docker provider 4.7.0 reads `cpus` back without a diff and replaces the container when it changes, so a CPU limit no longer needs a CFS quota computed by NemoClaw or a label that forces replacement. Signed-off-by: Carlos Villela <[email protected]>
Signed-off-by: Carlos Villela <[email protected]>
Collaborator
Author
Authoring session — opening
|
Contributor
cv
enabled auto-merge (squash)
November 16, 2026 16:34
cv
added a commit
that referenced
this pull request
Nov 16, 2026
Every managed vLLM and Ollama container on Docker now carries the `nemoclaw.nvidia.com/memory-limit-gib` label, including one with the default 104 GiB limit, so any memory limit change replaces the container. ## Problem The label, which forces replacement when the memory limit changes, was added only when the limit differed from 104 GiB, so containers created before memory limits were configurable stayed unchanged. That branch is compatibility code, and its reason for the label was incomplete: it named only the OOM kill, not that the servers size from the limit at start. ## Change - `docker_container` always gets the label; the 104 GiB branch and the `DEFAULT_MEMORY_LIMIT_GIB` re-export that only it used are gone. - The comment records why a memory change must restart the container: Docker provider 4.7.0 updates `memory` and `memory_swap` in place, Docker applies a lower limit to the running server and the kernel OOM-kills it, and Ollama and NemoClaw's supervisor size from the limit only at start. - Omitting the limit and declaring `memoryLimitGiB: 104` still compile the same container. - The `Preserve` check that refuses an in-place memory decrease stays. - `provider.md` describes the label without the 104 GiB exception, `inference.md` drops the sentence about earlier bundles, and the release notes drop the one-time replacement notes for this label and for `cpuLimitMillis` (#14491), since intent record 22 already makes every `v0.1.0-rc10` deployment redeploy. ## Beyond CI With OpenTofu 1.13.9, Docker provider 4.7.0, and Docker Engine 29.6.2 on linux/arm64, a container without the label and with `memory_swap` equal to `memory` planned `["update"]` for each memory change and kept running when the limit rose or stayed above its usage. Lowered below its usage, apply succeeded and the kernel OOM-killed the container (exit 137, `OOMKilled`). Ollama v0.40.16 reads `memory.max` and `memory.current` when it loads a model, and NemoClaw loads one model once; on GB10, CUDA allocations don't count toward the container's memory cgroup. --------- Signed-off-by: Carlos Villela <[email protected]>
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.
Managed vLLM and Ollama containers on Docker now get
container.cpuLimitMillisthrough the Docker provider'scpusattribute, so NemoClaw no longer computes a CFS quota or adds a label to force replacement when the limit changes.Problem
Before Docker provider 4.7.0,
cpusread back in a different format and replaced the container on every apply (kreuzwerker/terraform-provider-docker#1017), so NemoClaw setcpu_periodandcpu_quotaitself, raised quotas below 1 ms to the kernel's minimum, and added anemoclaw.nvidia.com/cpu-limit-millislabel, because the provider changescpu_quotain place without sending it to Docker. Provider 4.7.0, pinned since #14482, fixes the read-back, andcpusforces replacement.Change
docker_containersetscpusto the limit as a CPU count, such as"1.25"for 1250 millicores, and dropscpu_period,cpu_quota, and the CPU label. The native container configuration setsNanoCpusto match.--cpus 0.001and the runtime raises the quota to the kernel's minimum itself.cpuLimitMillisstill replaces the container, now because the provider markscpusas forcing replacement;updatePolicy: Preserverefuses it.cpuLimitMillis; the release notes list this as a breaking change.Beyond CI
With OpenTofu 1.13.9, Docker provider 4.7.0, and Docker Engine 29.6.2 on linux/arm64, a
docker_containerwithcpusplanned["delete", "create"]withreplace_paths = [["cpus"]]for each change (1.25, 2, 0.01, 12, 0.001), setHostConfig.NanoCpusto the authored value, and planned no changes on the unchanged reapply, including2read back as2.0. A container with--cpus 0.001ran withcpu.max1000 100000.