DNS problem: dig successful, ping fails (Docker container)

997 Views Asked by At

I am running a Java application inside a Docker container, which tries to scrape some content from the DHL tracking URL https://ecommerceportal.dhl.com/track/

This has been working fine, but a few days ago, it stopped working with an UnknownHostException.

From inside the Docker container, I am not able to ping the host:

root@4f0f68ab1e9f:/# ping ecommerceportal.dhl.com
ping: ecommerceportal.dhl.com: Name or service not known

But a DNS query via dig is successful:

root@4f0f68ab1e9f:/# dig ecommerceportal.dhl.com

; <<>> DiG 9.10.3-P4-Debian <<>> ecommerceportal.dhl.com
;; global options: +cmd
;; Got answer:
;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 7092
;; flags: qr rd ra; QUERY: 1, ANSWER: 3, AUTHORITY: 0, ADDITIONAL: 1

;; OPT PSEUDOSECTION:
; EDNS: version: 0, flags:; udp: 512
;; QUESTION SECTION:
;ecommerceportal.dhl.com.       IN      A

;; ANSWER SECTION:
ecommerceportal.dhl.com. 21171  IN      CNAME   ecommerceportal.dhl.com.edgekey.net.
ecommerceportal.dhl.com.edgekey.net. 299 IN CNAME e16593.a.akamaiedge.net.
e16593.a.akamaiedge.net. 19     IN      A       184.24.26.220

;; Query time: 25 msec
;; SERVER: 127.0.0.11#53(127.0.0.11)
;; WHEN: Wed Feb 10 12:34:13 UTC 2021
;; MSG SIZE  rcvd: 151

And, of couse, a ping to the IP 184.24.26.220 is working fine.

Also, pings to others hosts work well, so the container has access to the internet.

Does anybody have an idea what is going wrong? I also tried to replace the DNS server in my docker-compose file for the container, but without success.

Thanks and BR, Jan

1

There are 1 best solutions below

0
On

Thanks for the hint @Patrick. By trying with host I found out the problem was with the DNS server in my router. After a restart, the DNS resolution works fine again.