Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Cleanup docker disk space https://lebkowski.name/docker-volumes/
#!/bin/bash
# remove exited containers:
docker ps --filter status=dead --filter status=exited -aq | xargs docker rm -v
# remove unused images:
docker images --no-trunc | grep '<none>' | awk '{ print $3 }' | xargs docker rmi
# remove unused volumes:
docker volume ls -f dangling=true | awk '{ print $2 }' | xargs docker volume rm
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment