From: Luke GB Date: Sun, 14 Sep 2014 17:31:17 +0000 (+0100) Subject: Adds a docker_ip pipeline for /sbin/ip X-Git-Url: https://vcs.fsf.org/?a=commitdiff_plain;h=03bb0735cdd82476e119178e98a0c32a18137c22;p=discourse_docker.git 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. --- 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 () {