From 3fe9ccaf5e453a359389c183311f9cbfbd2b9a7e Mon Sep 17 00:00:00 2001 From: Elias Probst Date: Tue, 18 Jun 2013 19:55:59 +0200 Subject: [PATCH 1/2] Fixed #923 by replacing the usage of 'ifconfig' with 'ip a' where appropriate and added a note to use 'ip a' instead of 'ifconfig' for a screencast transscript. Upstream-commit: c2e95997d4c4dda9edbb4adaab8920f1b5982c25 Component: engine --- components/engine/README.md | 3 ++- .../engine/docs/sources/examples/running_redis_service.rst | 2 +- .../engine/docs/sources/examples/running_ssh_service.rst | 2 ++ components/engine/docs/sources/use/basics.rst | 3 ++- 4 files changed, 7 insertions(+), 3 deletions(-) diff --git a/components/engine/README.md b/components/engine/README.md index 1c909e5431..05312a3b45 100644 --- a/components/engine/README.md +++ b/components/engine/README.md @@ -216,7 +216,8 @@ PORT=$(docker port $JOB 4444) # 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. -IP=$(ifconfig eth0 | perl -n -e 'if (m/inet addr:([\d\.]+)/g) { print $1 }') +# Replace *eth0* according to your local interface name. +IP=$(ip -o -4 addr list eth0 | perl -n -e 'if (m{inet\s([\d\.]+)\/\d+\s}xms) { print $1 }') echo hello world | nc $IP $PORT # Verify that the network connection worked diff --git a/components/engine/docs/sources/examples/running_redis_service.rst b/components/engine/docs/sources/examples/running_redis_service.rst index 48d083aa8f..5f51fd33ab 100644 --- a/components/engine/docs/sources/examples/running_redis_service.rst +++ b/components/engine/docs/sources/examples/running_redis_service.rst @@ -72,7 +72,7 @@ Connect to the host os with the redis-cli. docker ps # grab the new container id docker port 6379 # grab the external port - ifconfig # grab the host ip address + ip a s # grab the host ip address redis-cli -h -p redis 192.168.0.1:49153> set docker awesome OK diff --git a/components/engine/docs/sources/examples/running_ssh_service.rst b/components/engine/docs/sources/examples/running_ssh_service.rst index 6183c3a55d..b32a648a7b 100644 --- a/components/engine/docs/sources/examples/running_ssh_service.rst +++ b/components/engine/docs/sources/examples/running_ssh_service.rst @@ -59,6 +59,7 @@ The password is 'screencast' # it has now given us a port to connect to # we have to connect using a public ip of our host $ hostname + # *ifconfig* is deprecated, better use *ip a s* now $ ifconfig $ ssh root@192.168.33.10 -p 49153 # Ah! forgot to set root passwd @@ -70,6 +71,7 @@ The password is 'screencast' $ docker commit 9e863f0ca0af31c8b951048ba87641d67c382d08d655c2e4879c51410e0fedc1 dhrp/sshd $ docker run -d -p 22 dhrp/sshd /usr/sbin/sshd -D $ docker port a0aaa9558c90cf5c7782648df904a82365ebacce523e4acc085ac1213bfe2206 22 + # *ifconfig* is deprecated, better use *ip a s* now $ ifconfig $ ssh root@192.168.33.10 -p 49154 # Thanks for watching, Thatcher thatcher@dotcloud.com diff --git a/components/engine/docs/sources/use/basics.rst b/components/engine/docs/sources/use/basics.rst index 444b74db51..a8f7a9bad1 100644 --- a/components/engine/docs/sources/use/basics.rst +++ b/components/engine/docs/sources/use/basics.rst @@ -82,7 +82,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. - IP=$(ifconfig eth0 | perl -n -e 'if (m/inet addr:([\d\.]+)/g) { print $1 }') + # Replace *eth0* according to your local interface name. + IP=$(ip -o -4 addr list eth0 | perl -n -e 'if (m{inet\s([\d\.]+)\/\d+\s}xms) { print $1 }') echo hello world | nc $IP $PORT # Verify that the network connection worked From 65fe379064250448155131900aba9b6b5e35d22b Mon Sep 17 00:00:00 2001 From: Elias Probst Date: Wed, 19 Jun 2013 00:57:43 +0200 Subject: [PATCH 2/2] Use the canonical 'ip' commands to make it easier for new 'iproute2' users to understand the usage. Upstream-commit: bc9b91e501369264966263fc28bb516e6048b7e5 Component: engine --- .../engine/docs/sources/examples/running_redis_service.rst | 2 +- .../engine/docs/sources/examples/running_ssh_service.rst | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/components/engine/docs/sources/examples/running_redis_service.rst b/components/engine/docs/sources/examples/running_redis_service.rst index 5f51fd33ab..4996802e93 100644 --- a/components/engine/docs/sources/examples/running_redis_service.rst +++ b/components/engine/docs/sources/examples/running_redis_service.rst @@ -72,7 +72,7 @@ Connect to the host os with the redis-cli. docker ps # grab the new container id docker port 6379 # grab the external port - ip a s # grab the host ip address + ip addr show # grab the host ip address redis-cli -h -p redis 192.168.0.1:49153> set docker awesome OK diff --git a/components/engine/docs/sources/examples/running_ssh_service.rst b/components/engine/docs/sources/examples/running_ssh_service.rst index b32a648a7b..c2f8b86aca 100644 --- a/components/engine/docs/sources/examples/running_ssh_service.rst +++ b/components/engine/docs/sources/examples/running_ssh_service.rst @@ -59,7 +59,7 @@ The password is 'screencast' # it has now given us a port to connect to # we have to connect using a public ip of our host $ hostname - # *ifconfig* is deprecated, better use *ip a s* now + # *ifconfig* is deprecated, better use *ip addr show* now $ ifconfig $ ssh root@192.168.33.10 -p 49153 # Ah! forgot to set root passwd @@ -71,7 +71,7 @@ The password is 'screencast' $ docker commit 9e863f0ca0af31c8b951048ba87641d67c382d08d655c2e4879c51410e0fedc1 dhrp/sshd $ docker run -d -p 22 dhrp/sshd /usr/sbin/sshd -D $ docker port a0aaa9558c90cf5c7782648df904a82365ebacce523e4acc085ac1213bfe2206 22 - # *ifconfig* is deprecated, better use *ip a s* now + # *ifconfig* is deprecated, better use *ip addr show* now $ ifconfig $ ssh root@192.168.33.10 -p 49154 # Thanks for watching, Thatcher thatcher@dotcloud.com