docker日志清理
[root@ecs-62ed ~]# cat clean_docker_log.sh
#!/bin/sh
echo "======== start clean docker containers logs ========"
logs=$(find /var/lib/docker/containers/ -name *-json.log)
for log in $logs
do
echo "clean logs : $log"
cat /dev/null > $log
done
echo "======== end clean docker containers logs ========"
##每月1日凌晨4点清理docker日志
0 4 1 * * /script/clean_docker_log.sh