$ cat /etc/docker/daemon.json { "default-ulimits":{ "nofile":{ "Name":"nofile", "Hard":864000, "Soft":864000 } }, "log-driver":"json-file", "log-opts":{ "max-size":"100k", "max-file":"1" }, "registry-mirrors": [ "https://1nj0zren.mirror.aliyuncs.com", "https://docker.mirrors.ustc.edu.cn", "http://f1361db2.m.daocloud.io", "https://registry.docker-cn.com" ], "bip":"172.254.0.1/16" #防止ip 冲突 } $ cat /etc/logrotate.d/docker-logs /data/docker/containers/*/*.log { rotate 7 daily compress size=1M missingok delaycompress copytruncate } systemctl daemon-reload systemctl restart docker