Abhishek Pandey
Abhishek Pandey

Reputation: 399

Docker network issue: Server misbehaving

I am trying to resolve this network issue which I am facing multiple time while performing any docker commands like "Docker search Ubuntu".
I get an error saying:

"Error response from daemon: server misbehaving.

Can anyone help me on this?

Upvotes: 39

Views: 88735

Answers (6)

Yash Panchwatkar
Yash Panchwatkar

Reputation: 11

For Linux Users Open /etc/systemd/resolved.conf: Use a text editor with administrator privileges (e.g., sudo nano /etc/systemd/resolved.conf).

[Resolve]
DNS=8.8.8.8 8.8.4.4
# Some examples of DNS servers which may be used for DNS= and FallbackDNS=:
# Cloudflare: 1.1.1.1#cloudflare-dns.com 1.0.0.1#cloudflare-dns.com 2606:4700:4700::1111#cloudflare-dns.com 2606:4700:4700::1001#cloudflare-dns.com
# Google:     8.8.8.8#dns.google 8.8.4.4#dns.google 2001:4860:4860::8888#dns.google 2001:4860:4860::8844#dns.google
# Quad9:      9.9.9.9#dns.quad9.net 149.112.112.112#dns.quad9.net 2620:fe::fe#dns.quad9.net 2620:fe::9#dns.quad9.net
#DNS=
#FallbackDNS=
#Domains=
#DNSSEC=no
#DNSOverTLS=no
#MulticastDNS=no
#LLMNR=no
#Cache=no-negative
#CacheFromLocalhost=no
#DNSStubListener=yes
#DNSStubListenerExtra=
#ReadEtcHosts=yes
#ResolveUnicastSingleLabel=no
#StaleRetentionSec=0

Save the file: Save the changes to /etc/systemd/resolved.conf. Restart systemd-resolved: Run the command sudo systemctl restart systemd-resolved to apply the changes. Verify: Use resolvectl status to confirm that the DNS servers are now set correctly. You can also check /etc/resolv.conf (it might still point to 127.0.0.53, but that's okay; systemd-resolved handles the forwarding).

Upvotes: 0

Ravi Parekh
Ravi Parekh

Reputation: 5622

My issue not solved with stated Answer here.

This is problem with resolving Host... I was getting random error time out and misbehave

You need to enable through a configuration property experimentalHostResolver in %APPDATA%\rancher-desktop\settings.json. By default this property is set to false, meaning that the default DNS process in the rancher desktop will be handled through dnsmasq. However, if this property is set to true the default DNS lookup will switch to host-resolver.

NOTE: This feature can only be enabled for Windows currently and it is an experimental feature

You can take a look at the example settings.json file below as a reference:

   "kubernetes":{
      "experimentalHostResolver":true           <== This is the config!
   },

Reference

Upvotes: 1

George Ogden
George Ogden

Reputation: 835

Make sure that, when you run this, you are connected to the internet, as Docker needs to be able to do this.

Upvotes: 0

Matt Friedman
Matt Friedman

Reputation: 1563

Faster/Easier Solution: login to docker-machine and fix the dns.

Turns out you don't have to go to all the trouble and waiting associated with restarting docker-machine. Just login to the docker machine (i.e. docker-machine ssh default) and edit /etc/resolv.conf - Add the dns settings from your host machine at the top of resolv.conf.

This is more or less what happens when you restart docker-machine and explains why some repositories are unreachable sometimes after you switch networks.

Upvotes: 10

Paba
Paba

Reputation: 1115

I also had the exact same problem. Then I stopped the docker-machine and started it--it worked.

Upvotes: 3

Ian
Ian

Reputation: 5883

For those who have this problem, it is typically related to having an issue with your DNS being unable to resolve index.docker.io. I had this issue today working from home where my internet connection has a default DNS server that is notoriously flakey.

My dev environment is OSX and I easily solved the issue by changing my DNS servers in network settings to Google's DNS servers (8.8.8.8 and 8.8.4.4) and then restarting my docker host through docker-machine restart MACHINENAME

Upvotes: 25

Related Questions