Join GitHub today
GitHub is home to over 28 million developers working together to host and review code, manage projects, and build software together.
Sign upLinks and Container Naming #2162
Conversation
vieux
reviewed
Oct 17, 2013
vieux
reviewed
Oct 17, 2013
This comment has been minimized.
Show comment
Hide comment
This comment has been minimized.
|
Love this idea! |
tianon
referenced this pull request
Oct 24, 2013
Closed
Add container host names to `/etc/hosts` #2335
This comment has been minimized.
Show comment
Hide comment
This comment has been minimized.
paulepanter
Oct 24, 2013
Reading the proposal, I do not fully understand this. Why are names and links related at all? Why can’t the host name, passed with -h to docker run, simply be used as the name for a container?
I also do not understand, why the relationship has to be parent and child? Why the different levels?
paulepanter
commented
Oct 24, 2013
|
Reading the proposal, I do not fully understand this. Why are names and links related at all? Why can’t the host name, passed with I also do not understand, why the relationship has to be parent and child? Why the different levels? |
vieux
reviewed
Oct 24, 2013
View changes
runtime.go
This comment has been minimized.
Show comment
Hide comment
This comment has been minimized.
tianon
Oct 25, 2013
Member
The pseudo-docs here appear to be somewhat out of date. The first example mentions REDIS_PORT_6379_ADDR, but all I get is REDIS_PORT_6379_TCP (and REDIS_PORT and REDIS_NAME).
Also, the later example has db_PORT_6379_ADDR, but the env vars are always all-uppercased, aren't they? I realize these are semi-unofficial, but official docs will probably at least be based in part on them, and us mere mortals are learning the links feature from them in the meantime. :)
|
The pseudo-docs here appear to be somewhat out of date. The first example mentions REDIS_PORT_6379_ADDR, but all I get is REDIS_PORT_6379_TCP (and REDIS_PORT and REDIS_NAME). Also, the later example has db_PORT_6379_ADDR, but the env vars are always all-uppercased, aren't they? I realize these are semi-unofficial, but official docs will probably at least be based in part on them, and us mere mortals are learning the links feature from them in the meantime. :) |
This comment has been minimized.
Show comment
Hide comment
This comment has been minimized.
tianon
Oct 25, 2013
Member
Oh, reading back up, I see you initially describe the correct vars, they're just not necessarily correct in the examples.
|
Oh, reading back up, I see you initially describe the correct vars, they're just not necessarily correct in the examples. |
alexlarsson
and others
added some commits
Sep 17, 2013
crosbymichael
and others
added some commits
Oct 22, 2013
This comment has been minimized.
Show comment
Hide comment
This comment has been minimized.
shykes
Oct 26, 2013
Collaborator
Guys (@crosbymichael and @vieux) is this ready for review and merge? This branch is growing way too large, I'm seeing all sorts of things unrelated to links in there.
|
Guys (@crosbymichael and @vieux) is this ready for review and merge? This branch is growing way too large, I'm seeing all sorts of things unrelated to links in there. |
This comment has been minimized.
Show comment
Hide comment
This comment has been minimized.
crosbymichael
Oct 26, 2013
Contributor
Yes this is ready for a final review and merge. The only thing that is not releated to links in this branch is the static dockerinit changes, nothing else.
|
Yes this is ready for a final review and merge. The only thing that is not releated to links in this branch is the static dockerinit changes, nothing else. |
vieux
referenced this pull request
Oct 28, 2013
Closed
Clarified the documentation for the -p flag. #2406
vieux
and others
added some commits
Oct 28, 2013
This comment has been minimized.
Show comment
Hide comment
This comment has been minimized.
This comment has been minimized.
Show comment
Hide comment
This comment has been minimized.
shykes
Oct 29, 2013
Collaborator
Note: the spec in this issue is now out-of-date. But as long as the docs are not, it doesn't matter :)
|
Note: the spec in this issue is now out-of-date. But as long as the docs are not, it doesn't matter :) |
added a commit
that referenced
this pull request
Oct 29, 2013
crosbymichael
merged commit b038b0c
into
master
Oct 29, 2013
This comment has been minimized.
Show comment
Hide comment
This comment has been minimized.
shykes
Oct 29, 2013
Collaborator
NOTE @crosbymichael: I updated the text of the pull request to match the latest version :)
|
NOTE @crosbymichael: I updated the text of the pull request to match the latest version :) |
This comment has been minimized.
Show comment
Hide comment
This comment has been minimized.
tobstarr
Nov 14, 2013
Contributor
Is that really necessary in the base package? This breaks cross compilation of the docker root package when being used as a library.
|
Is that really necessary in the base package? This breaks cross compilation of the docker root package when being used as a library. |
This comment has been minimized.
Show comment
Hide comment
This comment has been minimized.
|
Yes, it is. This import registers the sqlite3 driver, see line 606. |

crosbymichael commentedOct 10, 2013
Links - Spec
Links are a way of expressing a relationship between one container and another. When you link a container, you create a parent/child relationship between the two. As a side effect links also allow you to name containers and reference them by name. Containers can be references by more than one name.
Breaking changes
This the new link feature we will be disabling intercontainer communication by default. Containers will not be able to communicate with each other over the docker0 bridge without having a link to that container. Even with a link, a parent can only communicate to the ports exposed by the child and nothing more.
Initially links will be expressed by injecting the child's data into the parent's environment accessible via namespaced variables:
Examples
REDIS_ENV_{key}={value}REDIS_PORT={value}REDIS_PORT_6379_TCP={value}.Create a named container
Link a container into another
Using the container named 'db1' from our previous example we will create a relationship between our webapp container and redis.
To create a link between two containers you add the
-linkflag to yourdocker runcommand passing the name and alias of the container that you want to link as the child. The alias will be used as the namespace to set environment variables in the parent container. The format is-link <name>:<alias>. The alias will be converted to ALL_CAPS when environment variables are created.Remove redis as a child of frontend
Introspecting the linked container's environment
Lets run another redis container with a password that the client must use to connect. We store the password in the environment of the container so we can use introspection to retreive the password by the parent.
Client Libs
With client libs you can simplify links more.
TLDR
Links are a way to express relationships between containers and allow introspection based on those relationships.