mirror of
https://github.com/moby/moby.git
synced 2026-01-11 18:51:37 +00:00
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>