From eaba8db4567ab30d6a6d76f81d16786bb1104fa0 Mon Sep 17 00:00:00 2001 From: Jason Meredith Date: Thu, 22 Oct 2015 12:00:59 -0400 Subject: [PATCH] Getting script to work with /bin/sh so you can use it on docker-machine or boot2docker --- docker-gc | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/docker-gc b/docker-gc index 895edd8..3c4717c 100755 --- a/docker-gc +++ b/docker-gc @@ -1,4 +1,4 @@ -#!/bin/bash +#!/bin/sh # Copyright (c) 2014 Spotify AB. # @@ -68,7 +68,7 @@ fi EXCLUDE_IDS_FILE="exclude_ids" EXCLUDE_CONTAINER_IDS_FILE="exclude_container_ids" -function date_parse { +date_parse() { if date --utc >/dev/null 2>&1; then # GNU/date echo $(date -u --date "${1}" "+%s") @@ -79,7 +79,7 @@ function date_parse { } # Elapsed time since a docker timestamp, in seconds -function elapsed_time() { +elapsed_time() { # Docker 1.5.0 datetime format is 2015-07-03T02:39:00.390284991 # Docker 1.7.0 datetime format is 2015-07-03 02:39:00.390284991 +0000 UTC utcnow=$(date -u "+%s") @@ -90,7 +90,7 @@ function elapsed_time() { echo $(($utcnow - $epoch)) } -function compute_exclude_ids() { +compute_exclude_ids() { # Find images that match patterns in the EXCLUDE_FROM_GC file and put their # id prefixes into $EXCLUDE_IDS_FILE, prefixed with ^ @@ -118,7 +118,7 @@ function compute_exclude_ids() { | sed 's/^/^/' > $EXCLUDE_IDS_FILE } -function compute_exclude_container_ids() { +compute_exclude_container_ids() { # Find containers matching to patterns listed in EXCLUDE_CONTAINERS_FROM_GC file # Implode their values with a \| separator on a single line PROCESSED_EXCLUDES=`cat $EXCLUDE_CONTAINERS_FROM_GC \