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

Links are deprecated #545

Closed
amouat opened this issue Mar 1, 2019 · 5 comments
Closed

Links are deprecated #545

amouat opened this issue Mar 1, 2019 · 5 comments
Labels
question Usability question, not directly related to an error with the image

Comments

@amouat
Copy link

amouat commented Mar 1, 2019

The documentation tells users to use --link to connect applications to the mysql container, but this is unnecessary and deprecated: https://docs.docker.com/network/links/

@amouat amouat changed the title Links are deprectaed Links are deprecated Mar 1, 2019
@tianon
Copy link
Member

tianon commented Mar 1, 2019 via email

@amouat
Copy link
Author

amouat commented Mar 1, 2019

Ok, thanks and apologies for not spotting that before.

Feel free to close, but I do feel this is pretty misleading for new users (who shouldn't be pushed towards links).

@amouat
Copy link
Author

amouat commented Mar 1, 2019

Wait, I'm missing something. Why would you need to explain --network? By default they'll be in the same network and able to communicate, right? There will need to some more work to get the port number, but I guess you could use docker port.

I think using links actually adds more complexity for the user, as now they have another concept to look up, only to find it's "legacy" and wonder why it was used here.

I can come up with an alternative as a PR if you would consider changing.

@wglambert wglambert added the question Usability question, not directly related to an error with the image label Mar 1, 2019
@thaJeztah
Copy link

I (personally) don't think it should recommend using --link, but use a custom network instead.

Note that --link itself is not deprecated, but (yes, it's confusing) uses a different implementation when using a custom network.

On the default (bridge) network, links are actual "links" between containers. They have a lot of limitations (eg it's not possible to replace a linked container, as it's hard-wired to the actual container, so to re-establish a link, both containers have to be recreated), they also leak environment variables to any linked container, which may not always be desirable.

I actually proposed to replace the old (hard-wired) links, and use the same approach for both the default bridge network as for custom networks, and use the embedded DNS for all cases; moby/moby#22295, but that needs further discussion (should all behaviours of the old links stay in place, including the environment-variables?)

@amouat
Copy link
Author

amouat commented Mar 19, 2019

Just wanted to say thanks for this @yosifkit ; I think it was worth the work.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
question Usability question, not directly related to an error with the image
Projects
None yet
Development

No branches or pull requests

4 participants