Docker Desktop keeps adding my network address to my hosts file regardless of what is already in there:
# Added by Docker Desktop
192.168.12.123 host.docker.internal
192.168.12.123 gateway.docker.internal
This is a real problem for me because when I go from my home network to my office network I end up with two sets of conflicting mappings for these names and then these names fail to resolve causing calls to local endpoints to fail. I already have host.docker.internal mapped to 127.0.0.1 and want to keep it that way.
You should be able to turn this behavior off or at the very least be prompted when DD is making these changes.
Is there any way to prevent this behavior other than revoking DD permissions on the file?
Developers at my company run into this same issue. We set the host.docker.internal hostname to 127.0.0.1 to get around this, but these “Added by Docker Desktop” host entries keep getting added back into the hosts file and cause DNS resolution issues. Our Windows users see this issue the most. I would ask that users have a settings option that we can use to disable this
Additional info:
OS Version/Build: Windows 10 Enterprise 1909, 18363.657
Docker Desktop version: 2.2.0.3 (42716)
Steps to reproduce:
Start Docker Desktop
Edit %system%\drivers\etc\hosts file to use 127.0.0.1 for the host.docker.internal hostname and remove the other automatically added entries. Save the changes
Afaik, this is controlled by “Add the *.docker.internal names to the host’s /etc/hosts file (Requires password)” in the General section of the settings.