changeset 794:e059c4e85d9f

add docker cleanup helper
author Jeff Hammel <k0scist@gmail.com>
date Wed, 19 Oct 2016 09:04:34 -0700
parents 82db7fa25a35
children 171d85c69553
files bin/docker_vacuum.sh
diffstat 1 files changed, 12 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/bin/docker_vacuum.sh	Wed Oct 19 09:04:34 2016 -0700
@@ -0,0 +1,12 @@
+#!/bin/bash
+
+# http://blog.yohanliyanage.com/2015/05/docker-clean-up-after-yourself/
+
+# Make sure exited containers are deleted
+docker rm -v $(docker ps -a -q -f status=exited)
+
+# Remove unwanted 'dangling' images
+docker rmi $(docker images -f "dangling=true" -q)
+
+# Remove unwanted volumes
+docker volume rm $(docker volume ls -qf dangling=true)