Skip to content
This repository was archived by the owner on Feb 2, 2021. It is now read-only.
Closed
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
3 changes: 2 additions & 1 deletion docker-gc
Original file line number Diff line number Diff line change
Expand Up @@ -238,7 +238,7 @@ comm -23 containers.all containers.reap > containers.keep
# List images used by containers that we keep.
cat containers.keep |
xargs -n 1 $DOCKER inspect -f '{{.Image}}' 2>/dev/null |
sort | uniq > images.used
sed 's/sha256://' | sort | uniq > images.used

# List images to reap; images that existed last run and are not in use.
echo -n "" > images.all
Expand All @@ -248,6 +248,7 @@ do
done | sort | uniq | while read line
do
$DOCKER images --no-trunc --format "{{.ID}} {{.CreatedAt}}" $line \
| sed 's/sha256://' \
| sort -k 2 -r \
| tail -n +$((MINIMUM_IMAGES_TO_SAVE+1)) \
| cut -f 1 -d " " \
Expand Down