Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Local alias support #19229

Merged
merged 2 commits into from Jan 13, 2016
Merged

Local alias support #19229

merged 2 commits into from Jan 13, 2016

Conversation

mavenugo
Copy link
Contributor

This PR brings in the required changes to support the local scoped provider alias proposal in #18699.
As discussed in the proposal : #18699 (comment), we will reuse --link for this purpose.

We will have another PR to address the Network scoped alias functionality proposed in #18699.

@mavenugo
Copy link
Contributor Author

@calavera @icecrime @thaJeztah I have temporarily included the engine-api vendoring commit in this PR to help CI succeed. I will rebase this PR once we have an officially vendored in the engine-api dependency. It would be great if we can have the docker/docker side changes & docs reviewed in parallel.

@vdemeester
Copy link
Member

Desgin makes sense to me, LGTM 😉

@cpuguy83
Copy link
Member

Originally was thinking links on connect was odd, but I guess it's the only way to actually link to other containers when it's not the primary network....

What's the behavior when on an overlay network and the containers are on separate hosts?

@mavenugo
Copy link
Contributor Author

What's the behavior when on an overlay network and the containers are on separate hosts?

@cpuguy83 it will work just as in bridge network. As explained in the proposal, links in non-default networks will be used as aliases and hence it has no static dependencies with the presence of linked container at the time of launch. when the linked container comes up at a later time, the container name will be propagated using the usual Service Discovery mechanisms and the alias is resolved via DNS.

Originally was thinking links on connect was odd, but I guess it's the only way to actually link to other containers when it's not the primary network....

Thats correct. Also it will avoid any confusions between the usage of links in docker run and docker network connect.

@tiborvass
Copy link
Contributor

to sum up my understanding:
UX is: docker network connect --link containername:localalias ...
and the same docker run --link containername:local alias that would now work on any network, except for the envvar and /etc/hosts behavior that's preserved for backwards compat on the default bridge network.

design +1

@mavenugo
Copy link
Contributor Author

@tiborvass 👍

@cpuguy83
Copy link
Member

design +1 here as well, moving to code review

This brings in the container-local alias functionality for containers
connected to u ser-defined networks.

Signed-off-by: Madhu Venugopal <madhu@docker.com>
Signed-off-by: Madhu Venugopal <madhu@docker.com>
@mavenugo
Copy link
Contributor Author

@tiborvass @cpuguy83 @vdemeester rebased on top of engine-api v0.2.1.

@cpuguy83
Copy link
Member

My only comment is... can we merge TestUserDefinedNetworkLinksWithRestart into TestUserDefinedNetworkLinks?

@calavera
Copy link
Contributor

LGTM

@mavenugo
Copy link
Contributor Author

@cpuguy83 i would like to keep them in different test-cases (though some of it are repeating), especially because I would like to treat the restart case as important one to highlight and manage instead of adding multiple important cases in the same test case.

@tiborvass
Copy link
Contributor

LGTM

@tiborvass
Copy link
Contributor

`legacy link` in default `bridge` network and the new `link` functionality in user defined
networks. The `legacy link` is static in nature and it hard-binds the container with the
alias and it doesnt tolerate linked container restarts. While the new `link` functionality
in user defined networks are dynamic in nature and supports linked container restarts
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

user-defined

@thaJeztah
Copy link
Member

Alright I briefly discussed with @moxiegirl; we will need a more extensive review on the docs changes that are needed for the "new" --links. Given the code-freeze we can use the time after code-freeze to work on that.

We should probably check all occurrences of --link to see if they need an updated description (both "docs" and "man pages");

pasted image at 2016_01_12 04_39 pm
pasted image at 2016_01_12 04_38 pm

@thaJeztah
Copy link
Member

So, based on my previous comment, LGTM (for now)

thaJeztah added a commit that referenced this pull request Jan 13, 2016
@thaJeztah thaJeztah merged commit 47d87d3 into moby:master Jan 13, 2016
@sdurrheimer
Copy link
Contributor

ping @albers new docker network connect --ip --ip6 --link options

@hackndoes
Copy link

when I am using the --link option it still puts the container on the same host as the container it links to as before. how to I use the aliasing across hosts in a way that will allow me to launch my container on another host in swarm and still use the alias. can you specify an example please?

@mavenugo
Copy link
Contributor Author

@hackndoes are you creating a network with overlay driver ?
If you are looking for multi-host link capability, you should use multi-host driver such as overlay or other 3rd party plugins.

PTAL : https://docs.docker.com/engine/userguide/networking/get-started-overlay/

@dnephin
Copy link
Member

dnephin commented Feb 25, 2016

@hackndoes it needs to be fixed in swarm: docker-archive/classicswarm#1811

For now you can either disable that filter (but I believe that will also disable volumes_from co-scheduling), or you can use network scoped aliases, instead of link aliases.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

10 participants