Skip to content

Instantly share code, notes, and snippets.

@zeppelinen
Last active September 10, 2020 12:34
Show Gist options
  • Save zeppelinen/00b243bad14467054b007395771b7f37 to your computer and use it in GitHub Desktop.
Save zeppelinen/00b243bad14467054b007395771b7f37 to your computer and use it in GitHub Desktop.
Script to truncate logs of all the docker containers
#!/usr/bin/env bash
for container in $(docker ps -q --all);
do
log_file=$(docker inspect --format='{{.LogPath}}' ${container})
echo "Truncate file ${log_file}"
echo "" > "${log_file}"
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment