Docker logs are way too big with default configuration, and it's eating up my server space.
I know I can configure /etc/docker/daemon.json and add something like this:
{
"log-driver": "json-file",
"log-opts": {
"max-size": "10m",
"max-file": "10"
}
}
and restart Docker service. But it only works for NEW containers.
Is there a way to update log rotation configuration of exsisting container without recreating it?
You can't change most container settings without recreating it (the list of available settings is here). I suggest you rather recreate containers with the new log policy because that is simpler and cleaner than the alternative, which is to configure logrotate for these files: /var/lib/docker/containers/*/*.log.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With