Created
January 22, 2018 21:32
-
-
Save kdeloach/65b0bcc28802460c107fec91c166a274 to your computer and use it in GitHub Desktop.
Inspect intermediate Docker images
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
set -eu | |
# Usage: ./docker_child_images.sh <image name> | |
image_name_or_id=$1 | |
sha1=$(docker images -a | grep $image_name_or_id | head -n 1 | column -t | sed 's/ \+/,/g' | cut -d, -f3) | |
if [ ! -z "$sha1" ]; then | |
# echo "$sha1" | |
docker images -a --no-trunc | grep $sha1 | |
fi | |
while [ ! -z "$sha1" ]; do | |
sha1=$(docker inspect $sha1 | grep Parent | cut -d'"' -f4 | cut -d":" -f2) | |
if [ ! -z "$sha1" ]; then | |
# echo "$sha1" | |
docker images -a --no-trunc | grep $sha1 | |
fi | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment