Need help?

Our experts have had an average response time of 13.52 minutes in October 2021 to fix urgent issues.

We will keep your servers stable, secure, and fast at all times for one fixed price.

Docker image DNS lookup error: How to resolve

by | Nov 17, 2021

Stuck with a Docker image DNS lookup error? Fear not, our Support Team is here with a solution.

At Bobcares, coming up with solutions for queries, big and small is a part of our Server Management Services.

Let’s take a look at how our Support Team resolved the DNS lookup error today.

About DNS lookup errors

Have you been experiencing a number of obscure errors with your applications?? This might be due to Docker’s internet connectivity issues. According to our Support Tech, this may be a result of failing DNS lookups. Resolving this issue will also help you bid adieu to the pesky docker image DNS lookup error.

Narrowing down docker image DNS lookup error

First, we will check the basic internet connectivity by pinging a public IP address. If it succeeds, you will get a similar output as seen below:

$ docker run busybox ping -c 1 # Ping a London-based NASA root nameserver PING ( 56 data bytes 64 bytes from seq=0 ttl=53 time=113.866 ms --- ping statistics --- 1 packets transmitted, 1 packets received, 0% packet loss round-trip min/avg/max = 113.866/113.866/113.866 ms

After that, let’s try resolving domain as shown below:

$ docker run busybox nslookup 
Address 1: nslookup: can't resolve ''

If you get a “can’t resolve” message as seen above, it indicates a problem with resolving DNS.

Why does docker image DNS lookup error occur?

Before we dive into resolving the issue, let’s take a look at why the DNS lookup errors keep occurring. In fact, a DNS server that is locally defined in the /etc/resolv.conf file, containers by default, use, Google’s public DNS server to resolve DNS.

Hence, the error occurs, then this process is interrupted. Interestingly, in some places, network administrators intentionally block public DNS servers to ensure that the network’s own DNS server is used instead.

In such cases, Docker containers that rely on the default configuration are unable to resolve DNS. Thereby making the internet unusable from within those containers.

Quick fix for docker image DNS lookup error

Our Support Engineers have come up with a quick fix to ensure that the docker container runs with a custom DNS server.

  1. First, we will track down the address of the DNS server from within Ubuntu with the following command:
    $ nmcli dev show | grep 'IP4.DNS' 
  2. Then, we will run a docker container with the DNS server obtained in the previous step. We will include the –dns flag as well with the command as seen below:
    $ docker run --dns busybox nslookup 
    Address 1: 
    Address 1: 2a00:1450:4008:811::200e 
    Address 2:

Permanent fix for docker image DNS lookup error

If you prefer a more permanent fix, our Support Engineers have that covered as well.

  1. First, we will change the DNS settings of the Docker daemon by creating the daemon configuration file at /etc/docker/daemon.json.
  2. Then, configure the daemon configuration file with a set of two DNS, namely, the network DNS server and the Google DNS server. The latter works as a backup in case the network DNS server is not available.
        "dns": ["", ""]
  3. After that, restart the docker service with the following command:
    sudo service docker restart

You can test this fix by pinging from any Docker container without having to override the DNS server. For instance:

$ docker run busybox nslookup 
Address 1: 
Address 1: 2a00:1450:4008:811::200e 
Address 2:

[Need a hand with another query? Give us a call today.]


At the end of the day, we learned how to resolve the DNS lookup error. The Support Team at Bobcares offered us a quick fix as well as a more permanent fix to resolve the issue.


Never again lose customers to poor server speed! Let us help you.

Our server experts will monitor & maintain your server 24/7 so that it remains lightning fast and secure.



Submit a Comment

Your email address will not be published. Required fields are marked *



Privacy Preference Center


Necessary cookies help make a website usable by enabling basic functions like page navigation and access to secure areas of the website. The website cannot function properly without these cookies.

PHPSESSID - Preserves user session state across page requests.

gdpr[consent_types] - Used to store user consents.

gdpr[allowed_cookies] - Used to store user allowed cookies.

PHPSESSID, gdpr[consent_types], gdpr[allowed_cookies]


Statistic cookies help website owners to understand how visitors interact with websites by collecting and reporting information anonymously.

_ga - Preserves user session state across page requests.

_gat - Used by Google Analytics to throttle request rate

_gid - Registers a unique ID that is used to generate statistical data on how you use the website.

smartlookCookie - Used to collect user device and location information of the site visitors to improve the websites User Experience.

_ga, _gat, _gid
_ga, _gat, _gid


Marketing cookies are used to track visitors across websites. The intention is to display ads that are relevant and engaging for the individual user and thereby more valuable for publishers and third party advertisers.

IDE - Used by Google DoubleClick to register and report the website user's actions after viewing or clicking one of the advertiser's ads with the purpose of measuring the efficacy of an ad and to present targeted ads to the user.

test_cookie - Used to check if the user's browser supports cookies.

1P_JAR - Google cookie. These cookies are used to collect website statistics and track conversion rates.

NID - Registers a unique ID that identifies a returning user's device. The ID is used for serving ads that are most relevant to the user.

DV - Google ad personalisation

IDE, test_cookie, 1P_JAR, NID, DV, NID
IDE, test_cookie


These are essential site cookies, used by the google reCAPTCHA. These cookies use an unique identifier to verify if a visitor is human or a bot.