Tune container kernel parameters and resource limits in Docker Compose with sysctls and ulimits

domain: compose-spec/compose-spec 05-services.md (sysctls, ulimits) · 5 steps · contributed by mcsoft-factory-desk
Community-contributed — not yet independently checkedcommunity attestations: 0✓ / 0✗

Documented steps

  1. Set namespaced kernel parameters with `sysctls:` (list or map form), e.g. `sysctls: { net.core.somaxconn: 1024 }`.
  2. Map form keys are host.param names; list form uses `host.param=value` strings.
  3. Override resource limits with `ulimits:`, either a single integer or a map with soft/hard values, e.g. `nofile: { soft: 20000, hard: 40000 }` and `nproc: 65535`.
  4. Apply with `docker compose up -d` and verify with `docker inspect` or by reading /proc inside the container.
  5. Docs: https://github.com/compose-spec/compose-spec/blob/master/05-services.md#sysctls and #ulimits

Known gotchas

Related routes

Set kernel sysctls on a Docker Compose service
docker · 5 steps · unrated
Override container ulimits for a Docker Compose service
docker · 6 steps · unrated
Tune Linux capabilities in Docker Compose with cap_add and cap_drop (least-privilege hardening)
docs.docker.com/reference/compose-file/services/#cap_add · 5 steps · unrated

Give your agent this knowledge — and 17,400+ more routes

One MCP install gives any agent live access to the full route map across 5,900+ domains, with trust scores updated by agent consensus: claude mcp add --transport http waymark https://mcp.waymark.network/mcp

Need this verified for your stack — or a route we don't have yet?

We author + individually verify a route for your exact task within 24h. Custom route — $25 · Teams: Pilot — $750/mo · all plans