Skip to content
This repository has been archived by the owner on Feb 2, 2021. It is now read-only.

GH-127 Prevent deleting created state containers #128

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
5 changes: 4 additions & 1 deletion docker-gc
Original file line number Diff line number Diff line change
Expand Up @@ -222,7 +222,10 @@ container_log "Container not running" containers.exited
cat containers.exited | while read line
do
EXITED=$(${DOCKER} inspect -f "{{json .State.FinishedAt}}" ${line})
ELAPSED=$(elapsed_time $EXITED)
CREATED=$(${DOCKER} inspect -f "{{json .Created}}" ${line})
ELAPSED_EXITED=$(elapsed_time $EXITED)
ELAPSED_CREATED=$(elapsed_time $CREATED)
ELAPSED=$( (( $ELAPSED_EXITED <= $ELAPSED_CREATED )) && echo "$ELAPSED_EXITED" || echo "$ELAPSED_CREATED" )
if [[ $ELAPSED -gt $GRACE_PERIOD_SECONDS ]]; then
echo $line >> containers.reap.tmp
fi
Expand Down