Browse Source

Merge pull request #3146 from jamtur01/linkedits

Some minor cleanup of the Links use document
Andy Rothfusz 11 years ago
parent
commit
0b0b0ca0f9
1 changed files with 14 additions and 12 deletions
  1. 14 12
      docs/sources/use/working_with_links_names.rst

+ 14 - 12
docs/sources/use/working_with_links_names.rst

@@ -1,6 +1,6 @@
 :title: Working with Links and Names
 :title: Working with Links and Names
 :description: How to create and use links and names
 :description: How to create and use links and names
-:keywords: Examples, Usage, links, docker, documentation, examples, names, name, container naming
+:keywords: Examples, Usage, links, linking, docker, documentation, examples, names, name, container naming
 
 
 .. _working_with_links_names:
 .. _working_with_links_names:
 
 
@@ -40,7 +40,7 @@ Links: service discovery for docker
 
 
 Links allow containers to discover and securely communicate with each other by using the
 Links allow containers to discover and securely communicate with each other by using the
 flag ``-link name:alias``. Inter-container communication can be disabled with the daemon
 flag ``-link name:alias``. Inter-container communication can be disabled with the daemon
-flag ``-icc=false``. With this flag set to false, Container A cannot access Container B
+flag ``-icc=false``. With this flag set to ``false``, Container A cannot access Container B
 unless explicitly allowed via a link. This is a huge win for securing your containers.
 unless explicitly allowed via a link. This is a huge win for securing your containers.
 When two containers are linked together Docker creates a parent child relationship
 When two containers are linked together Docker creates a parent child relationship
 between the containers. The parent container will be able to access information via
 between the containers. The parent container will be able to access information via
@@ -52,28 +52,29 @@ a secure tunnel for the parent to access. If a database container only exposes p
 then the linked container will only be allowed to access port 8080 and nothing else if
 then the linked container will only be allowed to access port 8080 and nothing else if
 inter-container communication is set to false.
 inter-container communication is set to false.
 
 
+For example, there is an image called ``crosbymichael/redis`` that exposes the
+port 6379 and starts the Redis server. Let's name the container as ``redis``
+based on that image and run it as daemon.
+
 .. code-block:: bash
 .. code-block:: bash
 
 
-    # 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.
     $ sudo docker run -d -name redis crosbymichael/redis
     $ 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
 into this one.
 into this one.
 
 
 Next, we can start a new web application that has a dependency on Redis and apply a link
 Next, we can start a new web application that has a dependency on Redis and apply a link
 to connect both containers. If you noticed when running our Redis server we did not use
 to connect both containers. If you noticed when running our Redis server we did not use
-the -p flag to publish the Redis port to the host system. Redis exposed port 6379 and
+the ``-p`` flag to publish the Redis port to the host system. Redis exposed port 6379 and
 this is all we need to establish a link.
 this is all we need to establish a link.
 
 
 .. code-block:: bash
 .. code-block:: bash
 
 
-    # Linking the redis container as a child
     $ sudo docker run -t -i -link redis:db -name webapp ubuntu bash
     $ sudo docker run -t -i -link redis:db -name webapp ubuntu bash
 
 
-When you specified -link redis:db you are telling docker to link the container named redis
-into this new container with the alias db. Environment variables are prefixed with the alias
+When you specified ``-link redis:db`` you are telling Docker to link the container named ``redis``
+into this new container with the alias ``db``. Environment variables are prefixed with the alias
 so that the parent container can access network and environment information from the containers
 so that the parent container can access network and environment information from the containers
 that are linked into it.
 that are linked into it.
 
 
@@ -103,11 +104,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.
+Running ``docker ps`` shows the 2 containers, and the ``webapp/db`` alias name for the redis container.
 
 
 .. code-block:: bash
 .. code-block:: bash
 
 
     $ docker ps
     $ docker ps
     CONTAINER ID        IMAGE                        COMMAND                CREATED              STATUS              PORTS               NAMES
     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     
+    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
+