Docker Container Error Code 137: How to Fix It

Medium 20-45 minutes High Severity Verified June 2026
Error Code
container exited with code 137
Brand
Docker
Product Type
dev_tool
Severity
High
DIY Difficulty
Medium
Estimated Fix Time
20-45 minutes
Docker error code 137 occurs when your container is killed by the system due to exceeding memory limits (Out of Memory or OOM-killed). This happens when your container tries to use more RAM than allocated by Docker's cgroup memory constraints.
Ad

Tools You'll Need

How to Fix Error Code container exited with code 137

  1. Check Current Memory Limits

  2. Increase Container Memory Limit

    Ensure your host system has sufficient available memory before increasing limits
  3. Optimize Application Memory Usage

  4. Enable Swap if Needed

    Swap can significantly slow down performance - use as a temporary solution only
  5. Monitor with Docker Logs

  6. Implement Memory Monitoring

Parts You May Need

Additional system RAM
Check Price on Amazon
SSD storage for swap
Check Price on Amazon
Additional system RAM
Check Price on Amazon
SSD storage for swap
Check Price on Amazon
Additional system RAM
Check Price on Amazon
SSD storage for swap
Check Price on Amazon
Additional system RAM
Check Price on Amazon
SSD storage for swap
Check Price on Amazon
Additional system RAM
Check Price on Amazon
SSD storage for swap
Check Price on Amazon
Additional system RAM
Check Price on Amazon
SSD storage for swap
Check Price on Amazon
Additional system RAM
Check Price on Amazon
SSD storage for swap
Check Price on Amazon
Additional system RAM
Check Price on Amazon
SSD storage for swap
Check Price on Amazon
Ad

When to Call a Professional

Contact a DevOps engineer or system administrator if you're running production workloads, need help with orchestration platforms like Kubernetes, or if memory issues persist after optimization attempts.

Frequently Asked Questions

What does Docker error code 137 mean exactly?
Error code 137 means your Docker container was killed by the Linux kernel's OOM (Out of Memory) killer because it exceeded the memory limit set by Docker's cgroup constraints.
How do I prevent Docker containers from getting OOM-killed?
Set appropriate memory limits using the -m flag, optimize your application's memory usage, monitor memory consumption with docker stats, and ensure your host has sufficient available memory.
Can I recover data from a container that exited with code 137?
If you mounted volumes or used bind mounts, your data should be safe on the host filesystem. However, any data stored only in the container's filesystem layer will be lost unless you committed it to an image beforehand.
Why does my container keep getting killed even with increased memory?
This usually indicates a memory leak in your application, inefficient code, or the memory limit is still too low for your workload. Profile your application and gradually increase memory while monitoring usage patterns.
How much memory should I allocate to my Docker container?
Start with your application's baseline memory requirement plus 20-50% buffer. Monitor actual usage with docker stats and adjust accordingly. Typical web applications need 512MB-2GB depending on complexity.