mirror of https://github.com/docker/docs.git
- Improved documentation and typos fixing (Thanks to @jamtur01)
This commit is contained in:
parent
981560c436
commit
353243a725
|
@ -7,9 +7,9 @@
|
||||||
Working with Links and Names
|
Working with Links and Names
|
||||||
============================
|
============================
|
||||||
|
|
||||||
From version 0.6.5 you are able to ``name`` a container and ``link`` it to another
|
From version 0.6.5 you are now able to ``name`` a container and ``link`` it to another
|
||||||
container by referring its name. This will create a relation parent->child where
|
container by referring to its name. This will create a parent -> child relationship
|
||||||
the parent container can see all the important information about its child.
|
where the parent container can see selected information about its child.
|
||||||
|
|
||||||
.. _run_name:
|
.. _run_name:
|
||||||
|
|
||||||
|
@ -18,14 +18,19 @@ Container Naming
|
||||||
|
|
||||||
.. versionadded:: v0.6.5
|
.. versionadded:: v0.6.5
|
||||||
|
|
||||||
You can now name your container by using ``-name`` flag. If no name is provided,
|
You can now name your container by using the ``-name`` flag. If no name is provided, Docker
|
||||||
Docker will automatically generate a name which can be seen by typing: ``docker ps``.
|
will automatically generate a name. You can see this name using the ``docker ps`` command.
|
||||||
|
|
||||||
.. code-block:: bash
|
.. code-block:: bash
|
||||||
|
|
||||||
# format is "sudo docker run -name <container_name> <image_name> <command>"
|
# format is "sudo docker run -name <container_name> <image_name> <command>"
|
||||||
$ sudo docker run -name test ubuntu /bin/bash
|
$ sudo docker run -name test ubuntu /bin/bash
|
||||||
|
|
||||||
|
# the flag "-a" Show all containers. Only running containers are shown by default.
|
||||||
|
$ sudo docker ps -a
|
||||||
|
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
|
||||||
|
2522602a0d99 ubuntu:12.04 /bin/bash 14 seconds ago Exit 0 test
|
||||||
|
|
||||||
.. _run_link:
|
.. _run_link:
|
||||||
|
|
||||||
Links: service discovery for docker
|
Links: service discovery for docker
|
||||||
|
@ -39,7 +44,8 @@ flag ``-icc=false``. With this flag set to false, Container A cannot access Cont
|
||||||
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
|
||||||
env variables of the child such as name, exposed ports, ip, and environment variables.
|
environment variables of the child such as name, exposed ports, IP and other selected
|
||||||
|
environment variables.
|
||||||
|
|
||||||
When linking two containers Docker will use the exposed ports of the container to create
|
When linking two containers Docker will use the exposed ports of the container to create
|
||||||
a secure tunnel for the parent to access. If a database container only exposes port 8080
|
a secure tunnel for the parent to access. If a database container only exposes port 8080
|
||||||
|
@ -76,7 +82,7 @@ about the child container.
|
||||||
|
|
||||||
.. code-block:: bash
|
.. code-block:: bash
|
||||||
|
|
||||||
$ sroot@4c01db0b339c:/# env
|
$ root@4c01db0b339c:/# env
|
||||||
|
|
||||||
HOSTNAME=4c01db0b339c
|
HOSTNAME=4c01db0b339c
|
||||||
DB_NAME=/webapp/db
|
DB_NAME=/webapp/db
|
||||||
|
|
Loading…
Reference in New Issue