From 18db1cf7f6fac2f807dbbea96a9d4372536c6a82 Mon Sep 17 00:00:00 2001 From: alexanderbeletsky Date: Fri, 26 Jul 2013 10:26:05 +0300 Subject: [PATCH 1/2] issue #120 add step to clean up all dead instances and none used images --- dokku | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/dokku b/dokku index 64890bcf5..31894633c 100755 --- a/dokku +++ b/dokku @@ -12,6 +12,10 @@ case "$1" in echo "-----> Release complete!" echo "-----> Deploying $APP ..." dokku deploy $APP $IMAGE + echo "-----> Deploy complete!" + echo "-----> Cleaning up ..." + dokku cleanup + echo "-----> Cleanup complete!" echo "=====> Application deployed:" echo " $(dokku url $APP)" echo @@ -58,6 +62,13 @@ case "$1" in pluginhook post-deploy $APP $port ;; + cleanup) + # delete all non-running container + docker ps -a | grep 'Exit' | awk '{print $1}' | xargs docker rm > /dev/null & + # delete unused images + docker images | grep '' | awk '{print $3}' | xargs docker rmi > /dev/null & + ;; + plugins) ls -1 -d $PLUGIN_PATH/*/ ;; From 84337da262fe9ecc23786570500f17b53a67d311 Mon Sep 17 00:00:00 2001 From: alexanderbeletsky Date: Fri, 26 Jul 2013 10:47:40 +0300 Subject: [PATCH 2/2] ignoring all error messages from clean up --- dokku | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/dokku b/dokku index 31894633c..d0f994cc1 100755 --- a/dokku +++ b/dokku @@ -64,9 +64,9 @@ case "$1" in cleanup) # delete all non-running container - docker ps -a | grep 'Exit' | awk '{print $1}' | xargs docker rm > /dev/null & + docker ps -a | grep 'Exit' | awk '{print $1}' | xargs docker rm 2> /dev/null & # delete unused images - docker images | grep '' | awk '{print $3}' | xargs docker rmi > /dev/null & + docker images | grep '' | awk '{print $3}' | xargs docker rmi 2> /dev/null & ;; plugins)