uci-docker-build/image-info

13 lines
307 B
Bash
Executable File

#!/bin/bash
[[ $1 == "-k" ]] && key=$2 && shift 2
tag=$(./make-tag $@)
info=$(docker image inspect $tag 2> /dev/null) || info=$(docker image inspect $1) ||
exit
if [[ $key ]]; then
# echo image: $tag, key:$key
echo $info | jq --arg k "$key" '.[] | .[$k]'
else
# quote to preserve newlines
echo "$info"
fi