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

Only "created" containers #193

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.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions docker-gc
Original file line number Diff line number Diff line change
Expand Up @@ -238,6 +238,12 @@ cat containers.exited | while read line
do
EXITED=$(${DOCKER} inspect -f "{{json .State.FinishedAt}}" ${line})
ELAPSED=$(elapsed_time $EXITED)
# If the container never started/finished and only was created
# we compare the created date.
if [ $EXITED = '"0001-01-01T00:00:00Z"' ] ; then
CREATEDAT=$(${DOCKER} inspect -f "{{json .Created}}" ${line})
ELAPSED=$(elapsed_time $CREATEDAT)
fi
if [[ $ELAPSED -gt $GRACE_PERIOD_SECONDS ]]; then
echo $line >> containers.reap.tmp
fi
Expand Down