Skip to content

Instantly share code, notes, and snippets.

@jcberthon
Forked from anildigital/gist:862675ec1b7bccabc311
Last active September 11, 2017 02:59
Show Gist options
  • Save jcberthon/8eb0caf2e6852cca51e3f5749fcece1a to your computer and use it in GitHub Desktop.
Save jcberthon/8eb0caf2e6852cca51e3f5749fcece1a to your computer and use it in GitHub Desktop.
Remove dangling docker images and volumes
docker images --quiet --filter=dangling=true | xargs --no-run-if-empty docker rmi
docker volume ls --quiet --filter=dangling=true | xargs --no-run-if-empty docker volume rm
@jcberthon
Copy link
Author

@pascalandy
Copy link

@jcberthon Do you see a difference between

docker volume rm `docker volume ls -q -f dangling=true`

and your CMD ?

docker volume ls --quiet --filter=dangling=true | xargs --no-run-if-empty docker volume rm

@pascalandy
Copy link

For the images I use:

docker system df; \
docker system prune --all --force; \
docker system df; \
docker image ls;

Cheers!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment