From 03bb0735cdd82476e119178e98a0c32a18137c22 Mon Sep 17 00:00:00 2001 From: Luke GB Date: Sun, 14 Sep 2014 18:31:17 +0100 Subject: [PATCH] Adds a docker_ip pipeline for /sbin/ip This fixes issues with systems which don't have ifconfig configured and have fully transitioned over to solely using /sbin/ip. --- launcher | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) diff --git a/launcher b/launcher index ee82bcb..055f8d4 100755 --- a/launcher +++ b/launcher @@ -16,11 +16,17 @@ local_discourse=local_discourse image=samsaffron/discourse:1.0.3 docker_path=`which docker.io || which docker` -docker_ip=`/sbin/ifconfig | \ - grep -B1 "inet addr" | \ - awk '{ if ( $1 == "inet" ) { print $2 } else if ( $2 == "Link" ) { printf "%s:" ,$1 } }' | \ - grep docker0 | \ - awk -F: '{ print $3 }';` +if [ -x /sbin/ip ]; then + docker_ip=`/sbin/ip addr show docker0 | \ + grep 'inet ' | \ + awk '{ split($2,a,"/"); print a[1] }';` +else + docker_ip=`/sbin/ifconfig | \ + grep -B1 "inet addr" | \ + awk '{ if ( $1 == "inet" ) { print $2 } else if ( $2 == "Link" ) { printf "%s:" ,$1 } }' | \ + grep docker0 | \ + awk -F: '{ print $3 }';` +fi usage () { -- 2.25.1