1
0
Fork 0
mirror of https://github.com/moby/moby.git synced 2022-11-09 12:21:53 -05:00

make the service example work

issue #98 requires connecting to localhost (which `hostname` may resolve to) will not work.
This commit is contained in:
Sridhar Ratnakumar 2013-04-07 00:41:24 -07:00
parent 8cf30395a1
commit 27feba4594

View file

@ -183,7 +183,9 @@ JOB=$(docker run -d -p 4444 base /bin/nc -l -p 4444)
PORT=$(docker port $JOB 4444) PORT=$(docker port $JOB 4444)
# Connect to the public port via the host's public address # 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 # Verify that the network connection worked
echo "Daemon received: $(docker logs $JOB)" echo "Daemon received: $(docker logs $JOB)"