From d1c4c92906db8926ac67eaabc76a41b656b1edff Mon Sep 17 00:00:00 2001 From: Martin Kovachev Date: Sat, 30 May 2020 14:10:00 +0300 Subject: [PATCH] Fixed a GO parser issue --- docker.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/docker.sh b/docker.sh index 2ddab93..f964926 100644 --- a/docker.sh +++ b/docker.sh @@ -80,9 +80,9 @@ if [ `echo ${containers} | wc -c` -gt "1" ]; then DOCKER_NET_INT=${DOCKER_INT} ipaddr=`docker inspect -f "{{.NetworkSettings.IPAddress}}" ${container}` else - bridge=$(docker inspect -f "{{.NetworkSettings.Networks.${netmode}.NetworkID}}" ${container} | cut -c -12) + bridge=$(docker inspect -f "{{with index .NetworkSettings.Networks \"${netmode}\"}}{{.NetworkID}}{{end}}" ${container} | cut -c -12) DOCKER_NET_INT=`docker network inspect -f '{{"'br-$bridge'" | or (index .Options "com.docker.network.bridge.name")}}' $bridge` - ipaddr=`docker inspect -f "{{.NetworkSettings.Networks.${netmode}.IPAddress}}" ${container}` + ipaddr=`docker inspect -f "{{with index .NetworkSettings.Networks \"${netmode}\"}}{{.IPAddress}}{{end}}" ${container}` fi rules=`docker port ${container} | sed 's/ //g'`