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)"