hosts file is not updated when restarting docker desktop after changing network interface.
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
I'm having the same issue on 4.30.0
can someone please look into this . doesn't look like something too difficult to fix. thanks.
Seeing this as well with recent versions.
Only reliable fix, as OP said, is to uncheck "Add the *.docker.internal names to the host's /etc/hosts file" option, allow the engine to re-start, then check it again, and apply/restart once more. At that point, I get a prompt that the "privileged helper" is not running, and after I acknowledge that prompt, my hosts file is updated.
(Or, alternatively, manually update hosts file.)
Oddly, restarting the "Docker Desktop Service" Windows Service, which is what I thought the privileged helper was, doesn't work.
Hi!, same here. When working in other places (other networks) host file on windows is not updated this is only triggered on docker update. The WSL 2 Option as @mdsharpe don't work for me even with privileges helper.