Configure log rotation globally.
BeginnerScenarioLimits, logging, health checks and restarts
Answer
Situation read → Default json-file logs grow unbounded.
What I'd do →
{
"log-driver": "local",
"log-opts": {"max-size": "20m", "max-file": "5"}
}
in /etc/docker/daemon.json; systemctl restart docker. Existing containers need recreation.
Why → The local driver compresses and rotates by default.
Interview tip → Changes apply only to new containers.
More on Limits, logging, health checks and restarts
A Java container is OOM-killed at 512 MB. Why isn't the heap the whole story?IntermediateHow do you cap CPU and memory for a container and what happens on exceed?BeginnerLatency spikes though CPU usage looks low (50%).Advanced`docker logs` is empty but the app is running.BeginnerShip container logs to a central system.IntermediateDefine a good restart policy for a production service.Beginner