0

I'm unable to dns resolve any public hostname from inside docker container running on Ubuntu:

e4e6b07dafb0:/# traceroute google.com
traceroute: bad address 'google.com

Tried to run the container with google public dns servers and it didn't help:

docker run --dns 8.8.8.8 -it docker.io/jonlabelle/network-tools:latest bash
e4e6b07dafb0:/# traceroute google.com
traceroute: bad address 'google.com'
e4e6b07dafb0:/# nslookup google.com
;; communications error to 8.8.8.8#53: timed out
;; communications error to 8.8.8.8#53: timed out
;; communications error to 8.8.8.8#53: timed out
;; no servers could be reached

Tried also to run nslookup google.com 8.8.8.8 inside the container to no avail.

Resolution on the docker host works.

Docker daemon details are below:

docker version
Client: Docker Engine - Community
 Version:           24.0.6
 API version:       1.43
 Go version:        go1.20.7
 Git commit:        ed223bc
 Built:             Mon Sep  4 12:32:12 2023
 OS/Arch:           linux/amd64
 Context:           default

Server: Docker Engine - Community
 Engine:
  Version:          24.0.6
  API version:      1.43 (minimum version 1.12)
  Go version:       go1.20.7
  Git commit:       1a79695
  Built:            Mon Sep  4 12:32:12 2023
  OS/Arch:          linux/amd64
  Experimental:     false
 containerd:
  Version:          1.6.24
  GitCommit:        61f9fd88f79f081d64d6fa3bb1a0dc71ec870523
 runc:
  Version:          1.1.9
  GitCommit:        v1.1.9-0-gccaecfc
 docker-init:
  Version:          0.19.0
  GitCommit:        de40ad0

How to resolve this error?

2
  • Are you running any firewall on the host machine ? if yes, ensure the docker interface and subnet are allowed to cross trough (forward) to the internet.
    – Flash
    Nov 1 at 14:47
  • thanks, I cleaned all the docker data and restarted docker daemon and the issue got resolved.
    – rok
    Nov 1 at 14:52

0

You must log in to answer this question.

Browse other questions tagged .