# Container exited with code 137 (OOMKilled) - memory limit too low

- **ID:** `docker/container-oom-killed-memory-limit`
- **Domain:** docker
- **Category:** resource_error
- **Error Code:** `137`
- **Verification:** ai_generated
- **Fix Rate:** 85%

## Root Cause

Container exceeded its memory limit and was killed by the kernel OOM killer, typically due to insufficient --memory or -m setting.

## Version Compatibility

| Version | Status | Introduced | Deprecated |
|---------|--------|------------|------------|
| Docker 24.0.7 | active | — | — |
| Docker 25.0.3 | active | — | — |
| containerd 1.7.13 | active | — | — |

## Workarounds

1. **Increase the memory limit when running the container: docker run -m 512m --memory-reservation 256m my_image** (85% success)
   ```
   Increase the memory limit when running the container: docker run -m 512m --memory-reservation 256m my_image
   ```
2. **Use docker stats to monitor actual usage and set limit 20% higher: docker stats <container_name>** (80% success)
   ```
   Use docker stats to monitor actual usage and set limit 20% higher: docker stats <container_name>
   ```
3. **For Docker Compose, add mem_limit in docker-compose.yml: services: app: mem_limit: 512m** (85% success)
   ```
   For Docker Compose, add mem_limit in docker-compose.yml: services: app: mem_limit: 512m
   ```

## Dead Ends

- **** — Rebuilding the image with more layers doesn't change runtime memory limits; the limit is set at container start. (70% fail)
- **** — Adding swap space may delay the OOM but doesn't fix the underlying memory exhaustion; the container may still be killed or become unstable. (60% fail)
- **** — Restarting the container without changing memory limits just repeats the same crash. (90% fail)
