Browse code

make the service example work

issue #98 requires connecting to localhost (which `hostname` may resolve to) will not work.

Sridhar Ratnakumar authored on 2013/04/07 16:41:24
Showing 1 changed files
... ...
@@ -183,7 +183,9 @@ JOB=$(docker run -d -p 4444 base /bin/nc -l -p 4444)
183 183
 PORT=$(docker port $JOB 4444)
184 184
 
185 185
 # Connect to the public port via the host's public address
186
-echo hello world | nc $(hostname) $PORT
186
+# Please note that because of how routing works connecting to localhost or 127.0.0.1 $PORT will not work.
187
+IP=$(ifconfig eth0 | perl -n -e 'if (m/inet addr:([\d\.]+)/g) { print $1 }')
188
+echo hello world | nc $IP $PORT
187 189
 
188 190
 # Verify that the network connection worked
189 191
 echo "Daemon received: $(docker logs $JOB)"