Added 'weave version' command per Issue #56

This commit is contained in:
Bryan Boreham committed 2014-09-15 16:32:19 +01:00
1 parent 25c4adf68e
commit 87a4dee7ea
1 file changed
+12
+12
View File
@@ -8,6 +8,7 @@ usage() {
echo "weave expose <ipaddr>/<subnet>"
echo "weave hide <ipaddr>/<subnet>"
echo "weave status"
echo "weave version"
echo "weave stop"
exit 1
}
@@ -122,6 +123,17 @@ case "$COMMAND" in
fi
exit 0
;;
version)
# Try the running container first; if no luck try the image
if ! DOCKERIMAGE=$(docker inspect --format='{{ .Image }}' weave 2>/dev/null) ; then
if ! DOCKERIMAGE=$(docker inspect --format='{{ .Id }}' zettio/weave 2>/dev/null) ; then
echo "Unable to find zettio/weave image." >&2
exit 1
fi
fi
docker images --no-trunc | grep $DOCKERIMAGE | grep -v latest | tr -s ' ' | cut -d ' ' -f 2
exit 0
;;
run)
[ $# -gt 0 ] || usage
IPADDR=$1