进去ssh,输入下面命令:
#!/bin/bash
echo “开始清理所有容器的日志文件”
logs=$(find /var/lib/docker/containers/ -name *-json.log)
for log in $logs
do
echo “清理日志文件: $log”
cat /dev/null > $log
done
echo “清理完成”
进去ssh,输入下面命令:
#!/bin/bash
echo “开始清理所有容器的日志文件”
logs=$(find /var/lib/docker/containers/ -name *-json.log)
for log in $logs
do
echo “清理日志文件: $log”
cat /dev/null > $log
done
echo “清理完成”