tuto1: script to count layers

This commit is contained in:
nemunaire 2017-06-25 20:40:48 +02:00
commit 021d1ba92a

12
tutorial/1/misc/count_layers.sh Executable file
View file

@ -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.