docker限制日志大小
突然发现服务器空间满了。排查到最后,居然是一个docker(nacos)的日志太大了。
占了57个G。
/var/lib/docker/containers/CONTAINER_ID/CONTAINER_ID-json.log
限制日志大小:
version: "3.9"
services:
some-service:
image: some-service
logging:
driver: "json-file"
options:
max-size: "200k"
max-file: "10"
/etc/docker/daemon.json:
{
"log-driver": "json-file",
"log-opts": {"max-size": "10m", "max-file": "10"}
}