From 27feba459492bb381a037bf2f4766d51fdf53812 Mon Sep 17 00:00:00 2001 From: Sridhar Ratnakumar Date: Sun, 7 Apr 2013 00:41:24 -0700 Subject: [PATCH 1/2] make the service example work issue #98 requires connecting to localhost (which `hostname` may resolve to) will not work. --- README.md | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 66ca656f68..ff86de8820 100644 --- a/README.md +++ b/README.md @@ -183,7 +183,9 @@ JOB=$(docker run -d -p 4444 base /bin/nc -l -p 4444) PORT=$(docker port $JOB 4444) # Connect to the public port via the host's public address -echo hello world | nc $(hostname) $PORT +# Please note that because of how routing works connecting to localhost or 127.0.0.1 $PORT will not work. +IP=$(ifconfig eth0 | perl -n -e 'if (m/inet addr:([\d\.]+)/g) { print $1 }') +echo hello world | nc $IP $PORT # Verify that the network connection worked echo "Daemon received: $(docker logs $JOB)" From 9875a9b1f1b59114356c129f42449e2d62427f65 Mon Sep 17 00:00:00 2001 From: Sridhar Ratnakumar Date: Sun, 7 Apr 2013 00:43:57 -0700 Subject: [PATCH 2/2] sync with README --- docs/sources/commandline/basics.rst | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/docs/sources/commandline/basics.rst b/docs/sources/commandline/basics.rst index 5da2012da5..8dd8ec9de3 100644 --- a/docs/sources/commandline/basics.rst +++ b/docs/sources/commandline/basics.rst @@ -69,7 +69,8 @@ Expose a service on a TCP port # Connect to the public port via the host's public address # Please note that because of how routing works connecting to localhost or 127.0.0.1 $PORT will not work. - echo hello world | nc $(hostname) $PORT + IP=$(ifconfig eth0 | perl -n -e 'if (m/inet addr:([\d\.]+)/g) { print $1 }') + echo hello world | nc $IP $PORT # Verify that the network connection worked echo "Daemon received: $(docker logs $JOB)"