diff --git a/docker-gc b/docker-gc index f62ce13..54aefe1 100755 --- a/docker-gc +++ b/docker-gc @@ -231,11 +231,15 @@ xargs -n 1 $DOCKER inspect -f '{{.Image}}' 2>/dev/null | sort | uniq > images.used # List images to reap; images that existed last run and are not in use. +echo -n "" > images.last-run +if [ -f images.all ]; then + cat images.all > images.last-run +fi $DOCKER images -q --no-trunc | sort | uniq > images.all # Find images that are created at least GRACE_PERIOD_SECONDS ago echo -n "" > images.reap.tmp -cat images.all | while read line +comm -23 images.last-run images.all | while read line do CREATED=$(${DOCKER} inspect -f "{{.Created}}" ${line}) ELAPSED=$(elapsed_time $CREATED)