diff scripts/console.sh @ 163:daf91a3bbee5 production v1.2.0

flow: Merged <release> 'v1.2.0' to <master> ('production').
author smith@nwoca.org
date Tue, 15 Aug 2017 21:59:23 +0100
parents 8f45c43ea7a4
children ae2b4a5294ff
line wrap: on
line diff
--- a/scripts/console.sh	Fri Jun 16 17:14:15 2017 +0100
+++ b/scripts/console.sh	Tue Aug 15 21:59:23 2017 +0100
@@ -1,11 +1,23 @@
 #!/bin/bash
+# connects to the telnet console of the application for the specified service of the current project
+# For docker 1.12 and compose 1.9 (and higher) assume project is assigned to a network 
+#  named "${project}_default" per SSDT templates.
 
-# connects to the telnet console of the application for the specified service of the current project
 source "$( dirname "${BASH_SOURCE[0]}")/.functions.sh"
 
 container=$(composeGetContainer ${1?"Must specify the app service of the console to connect to"} )
 
 ip=$(docker inspect -f '{{.NetworkSettings.IPAddress}}' $container)
 
-docker run -it -v ${PWD}:/tmp -v /ssdt:/ssdt --rm docker.ssdt.io/ssdt-utils telnet $ip 2000 | tee console.log
+if [ "$ip" == "" ]
+then
+   ip=$(docker inspect -f '{{range .NetworkSettings.Networks}}{{.IPAddress}}{{end}}' $container)
+   project=$(composeGetProject ${1} )
+fi
 
+if [ "$project" == "" ]
+then 
+  docker run -it -v ${PWD}:/tmp  -v ${SSDT_HOME}:/ssdt --rm docker.ssdt.io/ssdt-utils telnet $ip 2000 | tee console.log
+else
+  docker run -it --network ${project}_default --rm docker.ssdt.io/ssdt-utils telnet $ip 2000 | tee console.log
+fi