Browse code

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.

Elias Probst authored on 2013/06/19 02:55:59
Showing 4 changed files
... ...
@@ -216,7 +216,8 @@ PORT=$(docker port $JOB 4444)
216 216
 
217 217
 # Connect to the public port via the host's public address
218 218
 # Please note that because of how routing works connecting to localhost or 127.0.0.1 $PORT will not work.
219
-IP=$(ifconfig eth0 | perl -n -e 'if (m/inet addr:([\d\.]+)/g) { print $1 }')
219
+# Replace *eth0* according to your local interface name.
220
+IP=$(ip -o -4 addr list eth0 | perl -n -e 'if (m{inet\s([\d\.]+)\/\d+\s}xms) { print $1 }')
220 221
 echo hello world | nc $IP $PORT
221 222
 
222 223
 # Verify that the network connection worked
... ...
@@ -72,7 +72,7 @@ Connect to the host os with the redis-cli.
72 72
 
73 73
     docker ps  # grab the new container id
74 74
     docker port <container_id> 6379  # grab the external port
75
-    ifconfig   # grab the host ip address
75
+    ip a s   # grab the host ip address
76 76
     redis-cli -h <host ipaddress> -p <external port>
77 77
     redis 192.168.0.1:49153> set docker awesome
78 78
     OK
... ...
@@ -59,6 +59,7 @@ The password is 'screencast'
59 59
 	 # it has now given us a port to connect to
60 60
 	 # we have to connect using a public ip of our host
61 61
 	 $ hostname
62
+	 # *ifconfig* is deprecated, better use *ip a s* now
62 63
 	 $ ifconfig
63 64
 	 $ ssh root@192.168.33.10 -p 49153
64 65
 	 # Ah! forgot to set root passwd
... ...
@@ -70,6 +71,7 @@ The password is 'screencast'
70 70
 	 $ docker commit 9e863f0ca0af31c8b951048ba87641d67c382d08d655c2e4879c51410e0fedc1 dhrp/sshd
71 71
 	 $ docker run -d -p 22 dhrp/sshd /usr/sbin/sshd -D
72 72
 	 $ docker port a0aaa9558c90cf5c7782648df904a82365ebacce523e4acc085ac1213bfe2206 22
73
+	 # *ifconfig* is deprecated, better use *ip a s* now
73 74
 	 $ ifconfig
74 75
 	 $ ssh root@192.168.33.10 -p 49154
75 76
 	 # Thanks for watching, Thatcher thatcher@dotcloud.com
... ...
@@ -82,7 +82,8 @@ Expose a service on a TCP port
82 82
 
83 83
   # Connect to the public port via the host's public address
84 84
   # Please note that because of how routing works connecting to localhost or 127.0.0.1 $PORT will not work.
85
-  IP=$(ifconfig eth0 | perl -n -e 'if (m/inet addr:([\d\.]+)/g) { print $1 }')
85
+  # Replace *eth0* according to your local interface name.
86
+  IP=$(ip -o -4 addr list eth0 | perl -n -e 'if (m{inet\s([\d\.]+)\/\d+\s}xms) { print $1 }')
86 87
   echo hello world | nc $IP $PORT
87 88
 
88 89
   # Verify that the network connection worked