Skip to content

Instantly share code, notes, and snippets.

@michaelbunch
Created June 28, 2018 18:54
Show Gist options
  • Save michaelbunch/4fb62255e801f34040382d3b3bc8af25 to your computer and use it in GitHub Desktop.
Save michaelbunch/4fb62255e801f34040382d3b3bc8af25 to your computer and use it in GitHub Desktop.
Give Docker the deep clean it needs.
#!/bin/bash
echo "Flushing Docker... 🚽💦"
echo "Stopping container instances..."
docker stop $(docker ps -a -q) > /dev/null 2>&1
echo "Removing container instances..."
docker rm $(docker ps -a -q) > /dev/null 2>&1
echo "Removing cached images..."
docker rmi $(docker images -q) > /dev/null 2>&1
echo "Pruning old networks..."
docker network prune -f > /dev/null 2>&1
echo "Pruning old volumes..."
docker volume prune -f > /dev/null 2>&1
echo "Done. 👍"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment