Created
February 19, 2017 08:45
-
-
Save oliworx/ffcc594b41a5f4a1cdcb122a948a556c to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/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