DNS broken on Docker Desktop for windows

Trying to resolve DNS names in docker windows (windows containers) appears broken by default and with no easy way to resolve. There are dozens of posts about this, but few with fixes (and none of those have enough details or actually work).

  • To reproduce

    • install docker windows desktop
    • switch to windows container mode
    • docker  run -it mcr.microsoft.com/windows/servercore:ltsc2022 powershell
      inside container, run
      ping www.google.com
      and it fails to resolve the name
      • Then repeat above, adding –dns to docker run line and it all works
  • So issue is just the default DNS stuff not working with docker. You CAN workaround some issues by just specifying --dns on the command line. But not all (like docker build scripts) or scripts that indirectly use docker.

  "dns": [
  "builder": {
    "gc": {
      "defaultKeepStorage": "20GB",
      "enabled": true
  "experimental": false,
  "features": {
    "buildkit": true

But sadly this doesnt seem to work (appears totally ignored).

One more hint - I’ve found another workaround, and it maybe relevant to understanding the bug.

Specifying --network “Default Switch” command line argument to docker run also avoids the problem, so maybe there is some mistake in the default understanding / configuration for networking, but there is no UI to correct it in the current version of Docker desktop (despite screenshots of a network settings page in other docker questions on the web).