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

Network scoped alias support #19242

Merged
merged 1 commit into from Jan 14, 2016
Merged

Network scoped alias support #19242

merged 1 commit into from Jan 14, 2016

Conversation

mavenugo
Copy link
Contributor

Part #2 of the proposal : #18699 which brings in the network scoped alias support.

This PR + the local alias support (#19229) fixes #18699

@mavenugo
Copy link
Contributor Author

@cpuguy83 @vdemeester @calavera @icecrime 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.

We didn't cover the UX portion during the maintainers meeting. Hoping to get some consensus in this PR.

@@ -100,6 +101,7 @@ func Parse(cmd *flag.FlagSet, args []string) (*container.Config, *container.Host
cmd.Var(&flVolumes, []string{"v", "-volume"}, "Bind mount a volume")
cmd.Var(&flTmpfs, []string{"-tmpfs"}, "Mount a tmpfs directory")
cmd.Var(&flLinks, []string{"-link"}, "Add link to another container")
cmd.Var(&flAliases, []string{"-network-alias"}, "Add network scoped alias for the container")
Copy link
Contributor

Choose a reason for hiding this comment

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

I suggest renaming this to --net-alias to make it more convenient and consistent with --net

Copy link
Contributor

Choose a reason for hiding this comment

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

also the variable name should be flNetAliases

@tiborvass
Copy link
Contributor

UX wise:
I like docker network connect ... --alias myalias
and like I said, I would prefer changing docker run --network-alias foo ... to docker run --net-alias foo ....

Also, we should make it very clear the relationship between --net-alias and --name, and that --net-alias is not supported on the default bridge network.

Other than that, you have my +1.

@cpuguy83
Copy link
Member

What happens if you are connected to a network already and you want to use an additional alias?

@mavenugo
Copy link
Contributor Author

@cpuguy83 we dont have the support to dynamically updating the alias. the only way is to disconnect and reconnect with the list of new aliases.
(also, one can use --link as a way to workaround such cases where it can be handled as a consumer side alias).

@cpuguy83
Copy link
Member

Also seems possible for multiple containers to specify the same alias on a network.
What's the expected behavior here, and is it documented?

@mavenugo
Copy link
Contributor Author

@cpuguy83 yes. it is expected (and is a requirement for compose). The expected behavior in 1.10 is to provide high availability between the containers sharing the alias in that network. When one container goes down another one will start serving the request. We are not providing built-in load-balancing yet.
It is documented and I will push the docs once I get to move past the engine-api vendoring rebase.

@cpuguy83
Copy link
Member

design +1 from me as well with the changes mentioned by @tiborvass
Once you push docs and flag changes will move to code-review.

@mavenugo
Copy link
Contributor Author

@cpuguy83 @tiborvass rebased on top of engine-api v0.2.1 and addressed your comments.

The docs has some dependencies on #19229. Once it is merged, I will rebase this PR again to finish up the docs. PTAL.

@@ -100,6 +101,7 @@ func Parse(cmd *flag.FlagSet, args []string) (*container.Config, *container.Host
cmd.Var(&flVolumes, []string{"v", "-volume"}, "Bind mount a volume")
cmd.Var(&flTmpfs, []string{"-tmpfs"}, "Mount a tmpfs directory")
cmd.Var(&flLinks, []string{"-link"}, "Add link to another container")
cmd.Var(&flAliases, []string{"-net-alias"}, "Add network scoped alias for the container")
Copy link
Contributor

Choose a reason for hiding this comment

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

@mavenugo network-scoped

@jessfraz
Copy link
Contributor

LGTM (after tibor's comments)

@mavenugo
Copy link
Contributor Author

@tiborvass @jfrazelle @cpuguy83 rebased and addressed comments. PTAL.

@@ -115,6 +115,8 @@ func (cli *DockerCli) CmdNetworkConnect(args ...string) error {
flIPv6Address := cmd.String([]string{"-ip6"}, "", "IPv6 Address")
flLinks := opts.NewListOpts(runconfigopts.ValidateLink)
cmd.Var(&flLinks, []string{"-link"}, "Add link to another container")
flAliases := opts.NewListOpts(nil)
cmd.Var(&flAliases, []string{"-alias"}, "Add network scoped alias for the container")
Copy link
Contributor

Choose a reason for hiding this comment

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

network-scoped

i thought you'd grep it ;)

@mavenugo
Copy link
Contributor Author

@tiborvass

i thought you'd grep it ;)

this time I grep'ed and caught 2 more in the comments :)... fixed now.

@tiborvass
Copy link
Contributor

code lgtm, but haven't tested yet

@mavenugo
Copy link
Contributor Author

ping @cpuguy83 @thaJeztah

@cpuguy83
Copy link
Member

One thing that's a little weird, a container that is not explicitly named can not be resolved by an alias.

@tiborvass
Copy link
Contributor

Ping @vdemeester

@vdemeester
Copy link
Member

A tiny last comment but overall great \o/.

docs LGTM 🐍

@mavenugo
Copy link
Contributor Author

Windows failure is unrelated and am seeing the same failure in multiple PRs.

@vdemeester
Copy link
Member

@mavenugo yep 😭
ping @thaJeztah @jamtur01 @MHBauer @moxiegirl for one last look 😉

Signed-off-by: Madhu Venugopal <madhu@docker.com>
@thaJeztah
Copy link
Member

ping @mavenugo looks like you missed the network-connect man page
https://github.com/docker/docker/blob/master/man/docker-network-connect.1.md

can you add that, then we should be ready to go!

@mavenugo
Copy link
Contributor Author

@thaJeztah I forgot to comment on that earlier. This particular file needs some updates for multiple options. (ip, ip6, link and alias). I thought of addressing it via the other issue opened for addressing the docs. Is that okay ?

@thaJeztah
Copy link
Member

Alright, let's do that 😄

LGTM

@calavera
Copy link
Contributor

all 💚 merging! 🎉

calavera added a commit that referenced this pull request Jan 14, 2016
Network scoped alias support
@calavera calavera merged commit 73a5393 into moby:master Jan 14, 2016
@mavenugo
Copy link
Contributor Author

Thanks all.
@aanand can breath now :)

@vdemeester
Copy link
Member

🎉

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.

Proposal : Container alias
10 participants