Skip to content

Instantly share code, notes, and snippets.

@phiros
Created June 28, 2017 11:01
Show Gist options
  • Save phiros/4d2176e2e1ee9084fd39182a6448c837 to your computer and use it in GitHub Desktop.
Save phiros/4d2176e2e1ee9084fd39182a6448c837 to your computer and use it in GitHub Desktop.
#!/usr/bin/env bash
if [[ $UID != 0 ]]; then
echo "Must be run as root (Try: sudo ${0})"
exit 1
fi
echo "This script nukes dockers graph directory & any btrfs subvolumes in it"
echo "Abort with ctrl+c now if you don't want this to happen (nuking starts in 10s)"
sleep 10
systemctl stop docker
btrfs subvolume list / | grep var/lib/docker | awk '{print "/" $9}' | xargs btrfs subvolume delete
rm -rf /var/lib/docker
echo "Restart docker with: "
echo -e "\tsystemctl start docker"
echo ""
echo "You can check dockers status with:"
echo -e "\tsystemctl status docker"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment