Files
moby/libnetwork/etchosts
Rob Murray 8a81a97af5 Only delete /etc/hosts entries for disconnected network
When a container is connected to a network, it gets /etc/hosts
entries for its addresses on that network. So, when it's connected
to two networks, it has a hosts entry for each. For example, if
the hostname is the default short-id and it's connected to two
networks (172.19.0.0/16 and 172.20.0.0/17, plus IPv6 address for
each), the hosts file might include:

  172.19.0.2	4b92a573912d
  fd8c:c894:d68::2	4b92a573912d
  172.20.0.2	4b92a573912d
  fd8c:c894:d68:1::2	4b92a573912d

If the container is disconnected from 172.19.0.2, only remove
the hosts entries with addresses on that network.

Signed-off-by: Rob Murray <rob.murray@docker.com>
2024-11-13 19:35:58 +00:00
..