Browse code

Merge branch 'docs-example-fix' of git://github.com/faizkhan00/docker merges #1402

Andy Rothfusz authored on 2013/08/06 10:21:19
Showing 1 changed files
... ...
@@ -20,7 +20,7 @@ minutes and not entirely smooth, but gives you a good idea.
20 20
     <div style="margin-top:10px;">
21 21
       <iframe width="800" height="400" src="http://ascii.io/a/2637/raw" frameborder="0"></iframe>
22 22
     </div>
23
-	
23
+        
24 24
 You can also get this sshd container by using
25 25
 ::
26 26
 
... ...
@@ -33,47 +33,57 @@ The password is 'screencast'
33 33
 
34 34
 .. code-block:: bash
35 35
 
36
-	 # Hello! We are going to try and install openssh on a container and run it as a servic 
37
-	 # let's pull ubuntu to get a base ubuntu image. 
38
-	 $ docker pull ubuntu
39
-	 # I had it so it was quick
40
-	 # now let's connect using -i for interactive and with -t for terminal 
41
-	 # we execute /bin/bash to get a prompt.
42
-	 $ docker run -i -t ubuntu /bin/bash
43
-	 # now let's commit it 
44
-	 # which container was it?
45
-	 $ docker ps -a |more
46
-	 $ docker commit a30a3a2f2b130749995f5902f079dc6ad31ea0621fac595128ec59c6da07feea dhrp/sshd 
47
-	 # I gave the name dhrp/sshd for the container
48
-	 # now we can run it again 
49
-	 $ docker run -d dhrp/sshd /usr/sbin/sshd -D # D for daemon mode 
50
-	 # is it running?
51
-	 $ docker ps
52
-	 # yes!
53
-	 # let's stop it 
54
-	 $ docker stop 0ebf7cec294755399d063f4b1627980d4cbff7d999f0bc82b59c300f8536a562
55
-	 $ docker ps
56
-	 # and reconnect, but now open a port to it
57
-	 $ docker run -d -p 22 dhrp/sshd /usr/sbin/sshd -D 
58
-	 $ docker port b2b407cf22cf8e7fa3736fa8852713571074536b1d31def3fdfcd9fa4fd8c8c5 22
59
-	 # it has now given us a port to connect to
60
-	 # we have to connect using a public ip of our host
61
-	 $ hostname
62
-	 # *ifconfig* is deprecated, better use *ip addr show* now
63
-	 $ ifconfig
64
-	 $ ssh root@192.168.33.10 -p 49153
65
-	 # Ah! forgot to set root passwd
66
-	 $ docker commit b2b407cf22cf8e7fa3736fa8852713571074536b1d31def3fdfcd9fa4fd8c8c5 dhrp/sshd 
67
-	 $ docker ps -a
68
-	 $ docker run -i -t dhrp/sshd /bin/bash
69
-	 $ passwd
70
-	 $ exit
71
-	 $ docker commit 9e863f0ca0af31c8b951048ba87641d67c382d08d655c2e4879c51410e0fedc1 dhrp/sshd
72
-	 $ docker run -d -p 22 dhrp/sshd /usr/sbin/sshd -D
73
-	 $ docker port a0aaa9558c90cf5c7782648df904a82365ebacce523e4acc085ac1213bfe2206 22
74
-	 # *ifconfig* is deprecated, better use *ip addr show* now
75
-	 $ ifconfig
76
-	 $ ssh root@192.168.33.10 -p 49154
77
-	 # Thanks for watching, Thatcher thatcher@dotcloud.com
36
+         # Hello! We are going to try and install openssh on a container and run it as a servic 
37
+         # let's pull ubuntu to get a base ubuntu image. 
38
+         $ docker pull ubuntu
39
+         # I had it so it was quick
40
+         # now let's connect using -i for interactive and with -t for terminal 
41
+         # we execute /bin/bash to get a prompt.
42
+         $ docker run -i -t base /bin/bash
43
+         # yes! we are in!
44
+         # now lets install openssh
45
+         $ apt-get update
46
+         $ apt-get install openssh-server
47
+         # ok. lets see if we can run it.
48
+         $ which sshd
49
+         # we need to create priviledge separation directory
50
+         $ mkdir /var/run/sshd
51
+         $ /usr/sbin/sshd
52
+         $ exit
53
+         # now let's commit it 
54
+         # which container was it?
55
+         $ docker ps -a |more
56
+         $ docker commit a30a3a2f2b130749995f5902f079dc6ad31ea0621fac595128ec59c6da07feea dhrp/sshd 
57
+         # I gave the name dhrp/sshd for the container
58
+         # now we can run it again 
59
+         $ docker run -d dhrp/sshd /usr/sbin/sshd -D # D for daemon mode 
60
+         # is it running?
61
+         $ docker ps
62
+         # yes!
63
+         # let's stop it 
64
+         $ docker stop 0ebf7cec294755399d063f4b1627980d4cbff7d999f0bc82b59c300f8536a562
65
+         $ docker ps
66
+         # and reconnect, but now open a port to it
67
+         $ docker run -d -p 22 dhrp/sshd /usr/sbin/sshd -D 
68
+         $ docker port b2b407cf22cf8e7fa3736fa8852713571074536b1d31def3fdfcd9fa4fd8c8c5 22
69
+         # it has now given us a port to connect to
70
+         # we have to connect using a public ip of our host
71
+         $ hostname
72
+         # *ifconfig* is deprecated, better use *ip addr show* now
73
+         $ ifconfig
74
+         $ ssh root@192.168.33.10 -p 49153
75
+         # Ah! forgot to set root passwd
76
+         $ docker commit b2b407cf22cf8e7fa3736fa8852713571074536b1d31def3fdfcd9fa4fd8c8c5 dhrp/sshd 
77
+         $ docker ps -a
78
+         $ docker run -i -t dhrp/sshd /bin/bash
79
+         $ passwd
80
+         $ exit
81
+         $ docker commit 9e863f0ca0af31c8b951048ba87641d67c382d08d655c2e4879c51410e0fedc1 dhrp/sshd
82
+         $ docker run -d -p 22 dhrp/sshd /usr/sbin/sshd -D
83
+         $ docker port a0aaa9558c90cf5c7782648df904a82365ebacce523e4acc085ac1213bfe2206 22
84
+         # *ifconfig* is deprecated, better use *ip addr show* now
85
+         $ ifconfig
86
+         $ ssh root@192.168.33.10 -p 49154
87
+         # Thanks for watching, Thatcher thatcher@dotcloud.com
78 88
 
79 89