清除Docker日志文件

#!/bin/sh
# -- coding: utf-8 -- 
# --------------------------------------------------
# @Time : 2019/6/17 9:59 
# @Author : skywin886
# @File : auto_clean_docker.sh
# @Version : 1.0.0
# --------------------------------------------------

echo "清除/var/lib/docker/containers/目录下日志文件 释放占用空间"

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 ========"  

df -h | grep "Use%" ; df -h|grep "/dev"

你可能感兴趣的:(Shell)