Skip to content

Instantly share code, notes, and snippets.

@vangie
Created October 14, 2016 14:54
Show Gist options
  • Save vangie/70a73a6cfcd538e9bbc30f3e49c9e1fa to your computer and use it in GitHub Desktop.
Save vangie/70a73a6cfcd538e9bbc30f3e49c9e1fa to your computer and use it in GitHub Desktop.
clean docker container logs
#!/bin/bash
# sudo ./docker-logs-clean.sh container_name
logfile=$(docker inspect $1 | grep -G '"LogPath": "*"' | sed -e 's/.*"LogPath": "//g' | sed -e 's/",//g');
echo "clean log file of container $1: $logfile"
truncate -s 0 $logfile
echo "done."
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment