fix(up): clamp mem_limit below 200 MiB to the daemon minimum#134
Merged
Conversation
Apple Container enforces a 200 MiB minimum container memory size and rejects
smaller values with a confusing daemon error ("minimum memory amount allowed
is 200 MiB"). Common Docker values like `mem_limit: 128m` therefore failed
at the daemon boundary even though #125 parsed them correctly.
Parse the value to bytes and, when it falls below 200 MiB, raise it to `200m`
with a note — so existing Docker Compose files keep working instead of
failing to start. Values >= 200m and unparseable values pass through
unchanged.
Fixes #132
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.
Fixes #132.
Problem
mem_limit: 128m(a very common Docker value) fails to start:Apple Container enforces a 200 MiB minimum memory size. #125 parses the value correctly but passes it straight through, so sub-200m values die at the daemon boundary.
Fix
Parse
mem_limitto bytes and, when it falls below 200 MiB, raise it to200mwith a note. Values>= 200mand unparseable values (e.g. unresolved${VAR}) pass through unchanged.Verification
mem_limit: 128mand64mnow start (both show 200 MB) instead of failing.parseMemoryToBytes(b/k/m/g units, case-insensitive, garbage→nil) andclampMemoryLimit(raises small, leaves ≥200m, passes garbage through).