diff --git a/tutorial/1/misc/count_layers.sh b/tutorial/1/misc/count_layers.sh new file mode 100755 index 0000000..e26dac6 --- /dev/null +++ b/tutorial/1/misc/count_layers.sh @@ -0,0 +1,12 @@ +#!/bin/sh + +IMG="$1" +NLAYER=0 + +while [ "$IMG" != "" ] && [ "$IMG" != "null" ] +do + IMG=$(docker inspect "$IMG" | jq .[0].Parent | tr -d '"') + NLAYER=$(($NLAYER + 1)) +done + +echo $1 image has $NLAYER layers.