Search code examples
dockerkuberneteswindows-subsystem-for-linuxdocker-desktop

Docker Desktop running pods on WSL cannot resolve host name


I have the problem noted elsewhere regarding pods running in Docker Desktop via WSL:

Could not resolve host

In my specific case:

Could not resolve host: Could not resolve host: login.microsoftonline.com

Reading other such cases, here's what I've tried:

  • quit Docker Desktop

  • terminated WSL using net stop LxssManager

  • wsl -l -v revealed that all distros were in the Stopped state

  • edited C:\Windows\System32\drivers\etc\wsl.conf with the following...

    [network]
    generateHosts = false
    generateResolvConf = false
    
  • edited C:\ProgramData\Docker\config\daemon.json with the following...

    {  
      "dns": ["8.8.8.8"],    << I added this line (other lines were already present).
      "experimental": false,  
      "hosts": [  
        "npipe:////./pipe/docker_engine_windows"  
      ]  
    }
    
  • edited C:\Windows\System32\drivers\etc\resolve.conf with the following...

    nameserver 8.8.8.8
    
  • restarted WSL using net start LxssManager

  • restarted Docker Desktop

  • waited for all pods to have status Running

  • opened a pod shell

  • apt update

  • apt install curl

  • curl https://login.microsoftonline.com/[OMITTED]/federationmetadata/2007-06/federationmetadata.xml?appid=[OMITTED]

And the response:

curl: (6) Could not resolve host: login.microsoftonline.com

What else should I do?


Solution

  • In case you are using CoreDNS 1.10.1, rolling back to 1.10.0 has helped me. https://github.com/docker/for-win/issues/13768