summaryrefslogtreecommitdiff
path: root/bin
diff options
context:
space:
mode:
authormo khan <mo.khan@gmail.com>2020-05-05 16:48:13 -0600
committermo khan <mo.khan@gmail.com>2020-05-05 16:48:13 -0600
commit2f72d7f8d2873aba27a834c91a7b58199bd41388 (patch)
tree5b95f794071f81436f85892d46c48df01800042b /bin
parent60ac0f2df85e4e4655b96b358dcc1ba40fe61a3e (diff)
Check size of image in bytes
Diffstat (limited to 'bin')
-rwxr-xr-xbin/docker-size13
1 files changed, 13 insertions, 0 deletions
diff --git a/bin/docker-size b/bin/docker-size
new file mode 100755
index 0000000..37a3da1
--- /dev/null
+++ b/bin/docker-size
@@ -0,0 +1,13 @@
+#!/bin/sh
+
+set -e
+
+cd "$(dirname "$0")/.."
+
+IMAGE_NAME=${IMAGE_NAME:-$(basename "$PWD"):latest}
+MAX_SIZE=2684354560
+CURRENT_SIZE=$(docker image inspect "$IMAGE_NAME" --format='{{.Size}}')
+
+echo "Maximum (bytes): $MAX_SIZE"
+echo "Current (bytes): $CURRENT_SIZE"
+test "$MAX_SIZE" -gt "$CURRENT_SIZE"