docker / for-win

Bug reports for Docker Desktop for Windows
https://www.docker.com/products/docker#/windows
1.83k stars 279 forks source link

hosts file is not updated when restarting docker desktop after changing network interface. #14076

Open ryan65 opened 2 weeks ago

ryan65 commented 2 weeks ago

Description

Hi I work hybrid. at home I work wireless and at the office LAN. My docker desktop is configured to use WSL 2 based engine and I have the "Add the .docker.internal names to the hosts..." checked. When I switch from work to home and visa versa , I use a different network interface with a different local ip. I would expect docker desktop to update the hosts file with the local ip each time I restart docker desktop, but it doesn't. My hosts file remains with the previous mapping. The only way I manage to update the hosts file is to uncheck .docker.internal...." and then check again. Why doesnt it update the hosts file automatically each time the docker desktop restarts ? Thanks.

Reproduce

simply change the network adapter , and restart docker desktop. it doesn't update the hosts file.

Expected behavior

I would expect the hosts file to be updated with the default local ip of the current network interface , each time docker desktop is restarted.

docker version

4.29.0

docker info

4.29.0

Diagnostics ID

3EF2C50F-B991-4A34-A4A2-52D74F7F9E41/20240515055958

Additional Info

No response

dlindbergJC commented 1 week ago

I'm having the same issue on 4.30.0

ryan65 commented 6 days ago

can someone please look into this . doesn't look like something too difficult to fix. thanks.