Skip to content

Instantly share code, notes, and snippets.

@particledecay
Created January 16, 2020 16:25
Show Gist options
  • Save particledecay/7ddf0fc47060fef00dce53d07bbff2a9 to your computer and use it in GitHub Desktop.
Save particledecay/7ddf0fc47060fef00dce53d07bbff2a9 to your computer and use it in GitHub Desktop.
Clean up a system with docker on it regardless of version
[[ "$(echo "$(docker version -f '{{.Server.APIVersion}}')\n1.25" | sort -V | head -1)" == "1.25" ]] && (docker system df && docker system prune -a --volumes) || (docker rmi $(docker images --filter "dangling=true" -q --no-trunc) && docker volume rm $(docker volume ls -qf dangling=true) && docker rm $(docker ps -qa --no-trunc --filter "status=exited"))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment