Skip to content

Proposal: deprecate legacy /etc/hosts based --link and always use embedded DNS #22295

@thaJeztah

Description

@thaJeztah

For legacy reasons, --link on the default network still uses /etc/hosts for discovery of linked containers. This method is known to be not ideal, and to result in a corrupted /etc/hosts in some cases, see:

Since docker 1.10, user-defined networks use an embedded DNS for this purpose but the old behavior is kept around for the default network; see:

"Legacy links" also have slightly different semantics, and (for example) create environment-variables containing the IP-address of linked containers, and automatically sharing environment variables of linked containers. We've discouraged the use of these environment-variables for a long time,
but it's still possible some users rely on it.

I propose to officially mark "legacy links" as deprecated, and replace the functionality with the new links (DNS-based discovery) in a future version. Doing so no longer requires to keep two different code-paths, and gives a more consistent experience

Breaking changes

Replacing legacy links may be a breaking change for some cases. Listing these below (but let me know if I missed some);

  • Users parsing /etc/hosts to automate things (I think I read about some people doing so)
  • Users bind-mounting a custom /etc/hosts file to disable discovery
  • Users relying on the old environment-variables to automatically configure their applications. Keeping this behavior probably wouldn't make sense, because DNS-based discovery/links allows dynamically attaching / linking containers (which isn't currently possible with environment-variables)
  • Users using --icc=false; dns-based discovery allows communication between all containers on the same network, irregardless of this setting

We should discuss if we want to deprecate legacy links, and if we deprecate it completely, or want to keep some of the old behavior around.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions