Merge pull request #6846 from irbull/master

Fix the parent/child relationship in the docs
This commit is contained in:
Sven Dowideit 2014-07-07 10:27:27 +10:00
commit cf01997ebe
1 changed files with 5 additions and 5 deletions

View File

@ -149,16 +149,16 @@ Let's look at our linked containers using `docker ps`.
$ docker ps $ docker ps
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
349169744e49 training/postgres:latest su postgres -c '/usr About a minute ago Up About a minute 5432/tcp db 349169744e49 training/postgres:latest su postgres -c '/usr About a minute ago Up About a minute 5432/tcp db, web/db
aed84ee21bde training/webapp:latest python app.py 16 hours ago Up 2 minutes 0.0.0.0:49154->5000/tcp db/web,web aed84ee21bde training/webapp:latest python app.py 16 hours ago Up 2 minutes 0.0.0.0:49154->5000/tcp web
We can see our named containers, `db` and `web`, and we can see that the `web` We can see our named containers, `db` and `web`, and we can see that the `db`
containers also shows `db/web` in the `NAMES` column. This tells us that the containers also shows `web/db` in the `NAMES` column. This tells us that the
`web` container is linked to the `db` container in a parent/child relationship. `web` container is linked to the `db` container in a parent/child relationship.
So what does linking the containers do? Well we've discovered the link creates So what does linking the containers do? Well we've discovered the link creates
a parent-child relationship between the two containers. The parent container, a parent-child relationship between the two containers. The parent container,
here `db`, can access information on the child container `web`. To do this here `web`, can access information on the child container `db`. To do this
Docker creates a secure tunnel between the containers without the need to Docker creates a secure tunnel between the containers without the need to
expose any ports externally on the container. You'll note when we started the expose any ports externally on the container. You'll note when we started the
`db` container we did not use either of the `-P` or `-p` flags. As we're `db` container we did not use either of the `-P` or `-p` flags. As we're