memory limit
The most memory a container may use before the kernel kills a process inside it.
In more detail
Set it with --memory (short form -m), for example -m 64m for 64 megabytes. The value lands in the memory.max control group file, in bytes. When the container goes over it, the OOM killer ends a process inside that container, and the container typically exits with code 137.
Example
docker run --rm -m 64m alpine:3.20 cat /sys/fs/cgroup/memory.maxRelated terms
- control group — A Linux kernel feature that limits how much memory, processor time and other resources a group of processes may use.
- resource limit — A cap on how much memory, processor time or number of processes a container may use.
- OOM killer — The part of the Linux kernel that kills a process when memory runs out.
- exit code — A number a process returns when it finishes: 0 means success, anything else means something went wrong.
- memory — The fast, temporary working space where running programs keep their data; it is emptied when the machine powers off.
Taught in
- Requests, Limits And Quotas — Certified Kubernetes Application Developer (CKAD) Exam Prep
- Namespaces And Cgroups: Isolation And Limits — Docker Architecture & Production Containers
- Install Docker And Verify Your Environment — Docker Architecture & Production Containers
- Port Publishing, Localhost And Network Troubleshooting — Docker Architecture & Production Containers
- Environment, Secret Files And Runtime Restrictions — Docker Architecture & Production Containers
- Diagnose Crashes, Resource Limits And Unhealthy Containers — Docker Architecture & Production Containers
- Harden And Deliver The Complete Service Stack — Docker Architecture & Production Containers
- Requests, Limits, Quotas And Horizontal Autoscaling — Kubernetes: Production-Grade Container Orchestration
- Troubleshooting: OOMKilled, Throttling And Evictions — Kubernetes: Production-Grade Container Orchestration
- Runtime Configuration: CLI Flags & Native --env-file — Node.js Internals & Backend Services
- Production Hardening: Graceful Shutdown & Docker — Node.js Internals & Backend Services