Browse code

Merge pull request #1835 from metalivedev/1821-exampleslanding

fix #1821 landing page for examples

Andy Rothfusz authored on 2013/09/11 06:14:00
Showing 5 changed files
... ...
@@ -2,6 +2,28 @@
2 2
 :description: A simple hello world example with Docker
3 3
 :keywords: docker, example, hello world
4 4
 
5
+.. _running_examples:
6
+
7
+Running the Examples
8
+====================
9
+
10
+All the examples assume your machine is running the docker daemon. To
11
+run the docker daemon in the background, simply type:
12
+
13
+.. code-block:: bash
14
+
15
+   sudo docker -d &
16
+
17
+Now you can run docker in client mode: by defalt all commands will be
18
+forwarded to the ``docker`` daemon via a protected Unix socket, so you
19
+must run as root.
20
+
21
+.. code-block:: bash
22
+
23
+   sudo docker help
24
+
25
+----
26
+
5 27
 .. _hello_world:
6 28
 
7 29
 Hello World
... ...
@@ -49,4 +71,108 @@ See the example in action
49 49
     </div>
50 50
 
51 51
 
52
-Continue to the :ref:`hello_world_daemon` example.
52
+----
53
+
54
+.. _hello_world_daemon:
55
+
56
+Hello World Daemon
57
+==================
58
+
59
+.. include:: example_header.inc
60
+
61
+And now for the most boring daemon ever written!
62
+
63
+This example assumes you have Docker installed and the Ubuntu
64
+image already imported with ``docker pull ubuntu``.  We will use the Ubuntu
65
+image to run a simple hello world daemon that will just print hello
66
+world to standard out every second. It will continue to do this until
67
+we stop it.
68
+
69
+**Steps:**
70
+
71
+.. code-block:: bash
72
+
73
+    CONTAINER_ID=$(sudo docker run -d ubuntu /bin/sh -c "while true; do echo hello world; sleep 1; done")
74
+
75
+We are going to run a simple hello world daemon in a new container
76
+made from the *ubuntu* image.
77
+
78
+- **"docker run -d "** run a command in a new container. We pass "-d"
79
+  so it runs as a daemon.
80
+- **"ubuntu"** is the image we want to run the command inside of.
81
+- **"/bin/sh -c"** is the command we want to run in the container
82
+- **"while true; do echo hello world; sleep 1; done"** is the mini
83
+  script we want to run, that will just print hello world once a
84
+  second until we stop it.
85
+- **$CONTAINER_ID** the output of the run command will return a
86
+  container id, we can use in future commands to see what is going on
87
+  with this process.
88
+
89
+.. code-block:: bash
90
+
91
+    sudo docker logs $CONTAINER_ID
92
+
93
+Check the logs make sure it is working correctly.
94
+
95
+- **"docker logs**" This will return the logs for a container
96
+- **$CONTAINER_ID** The Id of the container we want the logs for.
97
+
98
+.. code-block:: bash
99
+
100
+    sudo docker attach $CONTAINER_ID
101
+
102
+Attach to the container to see the results in realtime.
103
+
104
+- **"docker attach**" This will allow us to attach to a background
105
+  process to see what is going on.
106
+- **$CONTAINER_ID** The Id of the container we want to attach too.
107
+
108
+Exit from the container attachment by pressing Control-C.
109
+
110
+.. code-block:: bash
111
+
112
+    sudo docker ps
113
+
114
+Check the process list to make sure it is running.
115
+
116
+- **"docker ps"** this shows all running process managed by docker
117
+
118
+.. code-block:: bash
119
+
120
+    sudo docker stop $CONTAINER_ID
121
+
122
+Stop the container, since we don't need it anymore.
123
+
124
+- **"docker stop"** This stops a container
125
+- **$CONTAINER_ID** The Id of the container we want to stop.
126
+
127
+.. code-block:: bash
128
+
129
+    sudo docker ps
130
+
131
+Make sure it is really stopped.
132
+
133
+
134
+**Video:**
135
+
136
+See the example in action
137
+
138
+.. raw:: html
139
+
140
+    <div style="margin-top:10px;">
141
+      <iframe width="560" height="350" src="http://ascii.io/a/2562/raw" frameborder="0"></iframe>
142
+    </div>
143
+
144
+The next example in the series is a :ref:`python_web_app` example, or
145
+you could skip to any of the other examples:
146
+
147
+.. toctree::
148
+   :maxdepth: 1
149
+
150
+   python_web_app
151
+   nodejs_web_app
152
+   running_redis_service
153
+   running_ssh_service
154
+   couchdb_data_volumes
155
+   postgresql_service
156
+   mongodb
53 157
deleted file mode 100644
... ...
@@ -1,95 +0,0 @@
1
-:title: Hello world daemon example
2
-:description: A simple hello world daemon example with Docker
3
-:keywords: docker, example, hello world, daemon
4
-
5
-.. _hello_world_daemon:
6
-
7
-Hello World Daemon
8
-==================
9
-
10
-.. include:: example_header.inc
11
-
12
-The most boring daemon ever written.
13
-
14
-This example assumes you have Docker installed and the Ubuntu
15
-image already imported with ``docker pull ubuntu``.  We will use the Ubuntu
16
-image to run a simple hello world daemon that will just print hello
17
-world to standard out every second. It will continue to do this until
18
-we stop it.
19
-
20
-**Steps:**
21
-
22
-.. code-block:: bash
23
-
24
-    CONTAINER_ID=$(sudo docker run -d ubuntu /bin/sh -c "while true; do echo hello world; sleep 1; done")
25
-
26
-We are going to run a simple hello world daemon in a new container
27
-made from the *ubuntu* image.
28
-
29
-- **"docker run -d "** run a command in a new container. We pass "-d"
30
-  so it runs as a daemon.
31
-- **"ubuntu"** is the image we want to run the command inside of.
32
-- **"/bin/sh -c"** is the command we want to run in the container
33
-- **"while true; do echo hello world; sleep 1; done"** is the mini
34
-  script we want to run, that will just print hello world once a
35
-  second until we stop it.
36
-- **$CONTAINER_ID** the output of the run command will return a
37
-  container id, we can use in future commands to see what is going on
38
-  with this process.
39
-
40
-.. code-block:: bash
41
-
42
-    sudo docker logs $CONTAINER_ID
43
-
44
-Check the logs make sure it is working correctly.
45
-
46
-- **"docker logs**" This will return the logs for a container
47
-- **$CONTAINER_ID** The Id of the container we want the logs for.
48
-
49
-.. code-block:: bash
50
-
51
-    sudo docker attach $CONTAINER_ID
52
-
53
-Attach to the container to see the results in realtime.
54
-
55
-- **"docker attach**" This will allow us to attach to a background
56
-  process to see what is going on.
57
-- **$CONTAINER_ID** The Id of the container we want to attach too.
58
-
59
-Exit from the container attachment by pressing Control-C.
60
-
61
-.. code-block:: bash
62
-
63
-    sudo docker ps
64
-
65
-Check the process list to make sure it is running.
66
-
67
-- **"docker ps"** this shows all running process managed by docker
68
-
69
-.. code-block:: bash
70
-
71
-    sudo docker stop $CONTAINER_ID
72
-
73
-Stop the container, since we don't need it anymore.
74
-
75
-- **"docker stop"** This stops a container
76
-- **$CONTAINER_ID** The Id of the container we want to stop.
77
-
78
-.. code-block:: bash
79
-
80
-    sudo docker ps
81
-
82
-Make sure it is really stopped.
83
-
84
-
85
-**Video:**
86
-
87
-See the example in action
88
-
89
-.. raw:: html
90
-
91
-    <div style="margin-top:10px;">
92
-      <iframe width="560" height="350" src="http://ascii.io/a/2562/raw" frameborder="0"></iframe>
93
-    </div>
94
-
95
-Continue to the :ref:`python_web_app` example.
... ...
@@ -5,16 +5,16 @@
5 5
 
6 6
 
7 7
 Examples
8
-============
8
+========
9 9
 
10
-Contents:
10
+Here are some examples of how to use Docker to create running
11
+processes, starting from a very simple *Hello World* and progressing
12
+to more substantial services like you might find in production.
11 13
 
12 14
 .. toctree::
13 15
    :maxdepth: 1
14 16
 
15
-   running_examples
16 17
    hello_world
17
-   hello_world_daemon
18 18
    python_web_app
19 19
    nodejs_web_app
20 20
    running_redis_service
21 21
deleted file mode 100644
... ...
@@ -1,23 +0,0 @@
1
-:title: Running the Examples
2
-:description: An overview on how to run the docker examples
3
-:keywords: docker, examples, how to
4
-
5
-.. _running_examples:
6
-
7
-Running the Examples
8
-
9
-All the examples assume your machine is running the docker daemon. To
10
-run the docker daemon in the background, simply type:
11
-
12
-   .. code-block:: bash
13
-
14
-      sudo docker -d &
15
-
16
-Now you can run docker in client mode: by defalt all commands will be
17
-forwarded to the ``docker`` daemon via a protected Unix socket, so you
18
-must run as root.
19
-
20
-   .. code-block:: bash
21
-
22
-      sudo docker help
... ...
@@ -113,10 +113,6 @@
113 113
 	    <form>
114 114
 	      <input type="text" id="st-search-input" class="st-search-input span3" style="width:160px;" />
115 115
 	    </form>
116
-	    <a href="http://swiftype.com?ref=pb">
117
-	      <img id="swiftype-img" src="http://swiftype.com/assets/media/swiftype-logo-lightbg-small.png"
118
-	      alt="Search by Swiftype" /> 
119
-	    </a>
120 116
         </div>
121 117
 
122 118
         <!-- body block -->