How do you stop logs from filling the disk?
BeginnerProductionResource Limits, Health & Reliability
Answer
json-file has no rotation by default. Set limits globally:
{ "log-driver": "local", "log-opts": { "max-size": "10m", "max-file": "5" } }
Existing containers need recreating to pick up changes. Disk-full from /var/lib/docker/containers/*/*-json.log is one of the most common production incidents.
More on Resource Limits, Health & Reliability
How do you set memory and CPU limits, and what happens when they are exceeded?BeginnerWhat is the difference between `--cpus`, `--cpu-shares` and `--cpuset-cpus`?BeginnerWhat does `--memory-reservation` do?AdvancedHow do you diagnose an OOM-killed container?IntermediateWhy do JVM and Node services in containers need explicit memory flags?IntermediateWhat is CPU throttling, and how do you detect it?Advanced