Docker volumes clean up

March 30th, 2017 Posted by Blog, DevOps, Tips 0 thoughts on “Docker volumes clean up”
docker volume rm $(docker volume ls -qf dangling=true)
08e4f5a8373f495d4ca1eeb5db09d25d22716b3d4c2b28636230935feb2cad1d
354a554f84701d51febd817a7fac437925b885a165076d4fbe6d360af39d3e5f
4b2318ceb2001542f3f4b2df8bbe0b0ca6818f8604a00e3df72e464cf599c902
8011c4439ec92b2f46b07741f21f5d43fae1282b953983432a0ae22d6f904635

Since docker 1.13, use the prune command, it is also available for image, volume and network.

docker volume prune
WARNING! This will remove all volumes not used by at least one container.
Are you sure you want to continue? [y/N] Y
Deleted Volumes:
08e4f5a8373f495d4ca1eeb5db09d25d22716b3d4c2b28636230935feb2cad1d
354a554f84701d51febd817a7fac437925b885a165076d4fbe6d360af39d3e5f
4b2318ceb2001542f3f4b2df8bbe0b0ca6818f8604a00e3df72e464cf599c902
8011c4439ec92b2f46b07741f21f5d43fae1282b953983432a0ae22d6f904635
Total reclaimed space: 0 B

If you want to clean everything in one time :

docker system prune

Continuous S.A.
Avenue des Hauts-Fourneaux 9
L-4362 Esch-sur-Alzette
Luxembourg

© Continuous S.A. 2017