Просмотр исходного кода

add an example of docker ps, and also of link aliases

Sven Dowideit 11 лет назад
Родитель
Сommit
48e1766527
2 измененных файлов с 20 добавлено и 2 удалено
  1. 9 0
      docs/sources/commandline/cli.rst
  2. 11 2
      docs/sources/use/working_with_links_names.rst

+ 9 - 0
docs/sources/commandline/cli.rst

@@ -799,6 +799,15 @@ Known Issues (kill)
       -notrunc=false: Don't truncate output
       -notrunc=false: Don't truncate output
       -q=false: Only display numeric IDs
       -q=false: Only display numeric IDs
 
 
+Running ``docker ps`` showing 2 linked containers.
+
+.. code-block:: bash
+
+    $ docker ps
+    CONTAINER ID        IMAGE                        COMMAND                CREATED              STATUS              PORTS               NAMES
+    4c01db0b339c        ubuntu:12.04                 bash                   17 seconds ago       Up 16 seconds                           webapp              
+    d7886598dbe2        crosbymichael/redis:latest   /redis-server --dir    33 minutes ago       Up 33 minutes       6379/tcp            redis,webapp/db     
+
 .. _cli_pull:
 .. _cli_pull:
 
 
 ``pull``
 ``pull``

+ 11 - 2
docs/sources/use/working_with_links_names.rst

@@ -54,9 +54,9 @@ inter-container communication is set to false.
 
 
 .. code-block:: bash
 .. code-block:: bash
 
 
-    # Example: there is an image called redis-2.6 that exposes the port 6379 and starts redis-server.
+    # Example: there is an image called crosbymichael/redis that exposes the port 6379 and starts redis-server.
     # Let's name the container as "redis" based on that image and run it as daemon.
     # Let's name the container as "redis" based on that image and run it as daemon.
-    $ sudo docker run -d -name redis redis-2.6
+    $ sudo docker run -d -name redis crosbymichael/redis
 
 
 We can issue all the commands that you would expect using the name "redis"; start, stop,
 We can issue all the commands that you would expect using the name "redis"; start, stop,
 attach, using the name for our container. The name also allows us to link other containers
 attach, using the name for our container. The name also allows us to link other containers
@@ -102,3 +102,12 @@ about the child container.
 
 
 Accessing the network information along with the environment of the child container allows
 Accessing the network information along with the environment of the child container allows
 us to easily connect to the Redis service on the specific IP and port in the environment.
 us to easily connect to the Redis service on the specific IP and port in the environment.
+
+Running ``docker ps`` shows the 2 containers, and the webapp/db alias name for the redis container.
+
+.. code-block:: bash
+
+    $ docker ps
+    CONTAINER ID        IMAGE                        COMMAND                CREATED              STATUS              PORTS               NAMES
+    4c01db0b339c        ubuntu:12.04                 bash                   17 seconds ago       Up 16 seconds                           webapp              
+    d7886598dbe2        crosbymichael/redis:latest   /redis-server --dir    33 minutes ago       Up 33 minutes       6379/tcp            redis,webapp/db