Last active
August 24, 2017 08:05
-
-
Save jolbax/b764ce4354c1dca1959012baae32e783 to your computer and use it in GitHub Desktop.
Shell to delete orphaned docker volumes in /var/lib/docker/volumes #docker
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
To delete orphaned volumes in Docker 1.9 and up you can also use the built-in docker volume commands instead of this docker-cleanup-volumes script. The built-in command also deletes any directory in /var/lib/docker/volumes that is not a volume so make sure you didn't put anything in there you want to save: | |
List: | |
$ docker volume ls -qf dangling=true | |
Cleanup: | |
$ docker volume rm $(docker volume ls -qf dangling=true) | |
Or, handling a no-op better but Linux specific: | |
$ 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