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

Containers in the Created state now respect the GRACE_PERIOD_SECONDS #179

Open
wants to merge 1 commit 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
6 changes: 4 additions & 2 deletions docker-gc
Original file line number Diff line number Diff line change
Expand Up @@ -222,8 +222,10 @@ container_log "Container not running" containers.exited
> containers.reap.tmp
cat containers.exited | while read line
do
EXITED=$(${DOCKER} inspect -f "{{json .State.FinishedAt}}" ${line})
ELAPSED=$(elapsed_time $EXITED)
# The .Created timestamp only exists for ontainers in the Created State.
# The .State.FinishedAt is invalid for containers in the Created State.
IFS=' ' read FINISHED_AT CREATED <<< $(${DOCKER} inspect -f "{{json .State.FinishedAt}} {{json .Created}}" ${line})
ELAPSED=$(elapsed_time ${CREATED:-$FINISHED_AT})
if [[ $ELAPSED -gt $GRACE_PERIOD_SECONDS ]]; then
echo $line >> containers.reap.tmp
fi
Expand Down