Docker: DNS requests take 5 seconds


Requests to the Telegram messaging API on a docker container at work took 5 seconds:

$ time curl --silent --output /dev/null
real 0m5.577s

Doing a IPv4-only request was quick:

$ time curl -4 --silent --output /dev/null
real 0m0.090s


Inspecting the network traffic with wireshark shows that two DNS are made: One for the IPv4 address, one for the IPv6 address.

The IPv4 address is immediately resolved, but the IPv6 request is cancelled after 5 seconds:

Wireshark DNS traffic inspection


A thread on gave me the hint what to do: Disable parallel DNS requests, so that the IPv4 request is sent first. Only if that fails, the IPv6 request will be made.

options single-request

Written by Christian Weiske.

Comments? Please send an e-mail.