Skip to content

fix(up): clamp mem_limit below 200 MiB to the daemon minimum#134

Merged
Cyb3rDudu merged 1 commit into
mainfrom
fix/mem-limit-minimum
Jul 12, 2026
Merged

fix(up): clamp mem_limit below 200 MiB to the daemon minimum#134
Cyb3rDudu merged 1 commit into
mainfrom
fix/mem-limit-minimum

Conversation

@Cyb3rDudu

Copy link
Copy Markdown
Collaborator

Fixes #132.

Problem

mem_limit: 128m (a very common Docker value) fails to start:

Error: failed to create container (cause: "invalidArgument: minimum memory amount allowed is 200 MiB (got 134217728 bytes)")

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_limit to bytes and, when it falls below 200 MiB, raise it to 200m with a note. Values >= 200m and unparseable values (e.g. unresolved ${VAR}) pass through unchanged.

Note: Service 'small' mem_limit '128m' is below Apple Container's 200 MiB minimum; clamping to 200m.

Verification

  • Smoke test: services with mem_limit: 128m and 64m now start (both show 200 MB) instead of failing.
  • New unit tests: parseMemoryToBytes (b/k/m/g units, case-insensitive, garbage→nil) and clampMemoryLimit (raises small, leaves ≥200m, passes garbage through).

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
@Cyb3rDudu Cyb3rDudu merged commit 914b225 into main Jul 12, 2026
1 check passed
@Cyb3rDudu Cyb3rDudu deleted the fix/mem-limit-minimum branch July 12, 2026 17:23
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.

mem_limit below 200 MiB rejected by daemon with no guidance

1 participant