Skip to content

Instantly share code, notes, and snippets.

@Uysim
Forked from mlebkowski/cleanup-docker.sh
Last active May 29, 2018 06:12
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 Uysim/42fa9f3ce0aab74e8945fea64333f243 to your computer and use it in GitHub Desktop.
Save Uysim/42fa9f3ce0aab74e8945fea64333f243 to your computer and use it in GitHub Desktop.
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