Skip to content

Instantly share code, notes, and snippets.

@oliworx
Created February 19, 2017 08:45
Show Gist options
  • Save oliworx/ffcc594b41a5f4a1cdcb122a948a556c to your computer and use it in GitHub Desktop.
Save oliworx/ffcc594b41a5f4a1cdcb122a948a556c to your computer and use it in GitHub Desktop.
#!/bin/sh
# from https://lebkowski.name/docker-volumes/
# remove unused images
docker images --no-trunc | grep '<none>' | awk '{ print $3 }' | xargs -r docker rmi
# remove finished containers and their volumes
docker ps --filter status=dead --filter status=exited -aq | xargs docker rm -v
# remove old volumes, docker 1.9 and up only
docker volume ls -qf dangling=true | xargs -r docker volume rm
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment