According to the Docker docs, links are described as "legacy". In particular, there's this warning:
Warning: The --link flag is a deprecated legacy feature of Docker. It may eventually be removed. Unless you absolutely need to continue using it, we recommend that you use user-defined networks to facilitate communication between two containers instead of using --link. One feature that user-defined networks do not support that you can do with --link is sharing environmental variables between containers. However, you can use other mechanisms such as volumes to share environment variables between containers in a more controlled way.
Contrariwise, Docker Compose also has a "links" feature, which is not deprecated according to the Docker Compose docs.
Is there any relationship between the Docker "Legacy container links" feature and Docker Compose's "links" section? If so, why are they deprecated in one and not in the other? If not, why are they both called "links"?
(I originally asked this questions in the Docker forums, but got no reply).