Skip to content

Instantly share code, notes, and snippets.

@sarangnx
Created June 6, 2023 06:20
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save sarangnx/81c4fcd82d01226e14ae4ad798eced11 to your computer and use it in GitHub Desktop.
Save sarangnx/81c4fcd82d01226e14ae4ad798eced11 to your computer and use it in GitHub Desktop.
Delete logs of all docker containers
#!/bin/bash
container_ids=$(docker ps -q)
for container_id in $container_ids; do
sudo truncate -s 0 $(docker inspect --format='{{.LogPath}}' "$container_id")
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment