Disable modification of etc/hosts file for windows containers in Docker Desktop

This is on Windows 11 using Docker Desktop for Windows v. 4.30.0 . Using Windows Containers.

I frequently see this message in the docker log file as it attempts to build containers:

Error running exec 3c841b8b8962a3a802e28793c6a05d63196f83979afe74f07f47307f1e3bdac4 in container: container cd3fdfabfc43a914050d9036f9784a50a2921b84cb359d82e12dd0b74181af66 encountered an error during hcs::System::CreateProcess: cmd.exe /C “ECHO host.docker.internal >> %systemroot%\system32\drivers\etc\hosts & ECHO gateway.docker.internal >> %systemroot%\system32\drivers\etc\hosts”: failure in a Windows system call: The user name or password is incorrect. (0x52e)

This occurs whenever docker finishes building an intermediate container; this exception results in the internal container “dangling” rather than being deleted.

The Windows unique user LOCALSYSTEM owns the docker desktop service; a password does not apply to this account.

I would like to resolve this error … but also, I don’t WANT docker modifying the /etc/hosts file outside the container on the main computer.

I see there is the setting “Add the *.docker.internal names to the host’s /etc/hosts file (Requires password)” under “Use the WSL2 engine” – but I’m not building linux containers (more’s the pity). I’m using windows containers which run on Hyper-v.

I would like this option to be available for windows containers as well, not just for linux/WSL2 containers .


Brian P.