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

Alias containers by short id #2746

Merged
merged 1 commit into from
Jan 25, 2016

Conversation

aanand
Copy link

@aanand aanand commented Jan 25, 2016

This necessitates a small change in how we connect to networks: rather than setting links and aliases for the one arbitrarily-picked network the container joins on creation, we disconnect and reconnect it immediately after creating it, so that we can set the short-id alias.

Closes #2702.

Signed-off-by: Aanand Prasad <aanand.prasad@gmail.com>
@shin-
Copy link

shin- commented Jan 25, 2016

LGTM!

shin- added a commit that referenced this pull request Jan 25, 2016
@shin- shin- merged commit af6b18c into docker:master Jan 25, 2016
@aanand aanand deleted the alias-containers-by-short-id branch January 25, 2016 23:24
@aanand
Copy link
Author

aanand commented Jan 26, 2016

Cherry-picked into #2753


for network in self.networks:
if network in connected_networks:
self.client.disconnect_container_from_network(
container.id, network)
Copy link

Choose a reason for hiding this comment

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

Do we need to join a network when we create it? or could we just have it join all the networks here?

Copy link
Author

Choose a reason for hiding this comment

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

Yes, we need to set a NetworkMode or it'll default to bridge (and we'll just have to disconnect from that). I wondered about setting it to none, but it's then impossible to connect it to any networks.

Copy link

Choose a reason for hiding this comment

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

Good to know, thanks!

Might be worth making a feature request on engine for a way to accomplish this without connecting to a network originally.

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

5 participants