Docker Community Forums

Share and learn in the Docker community.

Docker Bind9 Unable To Resolve From Outside Container

I’m trying to move a Bind9 configuration into a Docker Container. The Docker Container is primarily running Bind9 and Apache2 (just to test). Both in a single container with Supervisor.

The Apache2 Host is configured as

<VirtualHost *:80>
   ServerName defaultweb.dnsserver.lan
   ServerAlias www.defaultweb.dnsserver.lan
   DocumentRoot /var/www/html/public_html/defaultweb
   <Directory "/var/www/html/public_html/defaultweb">
      Options FollowSymLinks MultiViews
      AllowOverride All
      Order allow,deny
      Allow from all

And the Bind9 configurations are as follows


zone "dnsserver.lan" {
        type master;
        file "/etc/bind/zones/db.dnsserver.lan";


options {
        directory "/var/cache/bind";
        recursion yes;
        listen-on { any; };
        forwarders {;; };


$TTL    604800
@       IN      SOA     dnsserver.lan. admin.dnsserver.lan. (
                              2         ; Serial
                         604800         ; Refresh
                          86400         ; Retry
                        2419200         ; Expire
                         604800 )       ; Negative Cache TTL
@       IN      NS      ns1.deb10serv.lan.
@       IN      NS      ns2.deb10serv.lan.
ns1.dnsserver.lan.      IN      A
ns2.dnsserver.lan.      IN      A
host.dnsserver.lan.     IN      A
defaultweb.dnsserver.lan.        IN      A

I’m starting the container with

docker run -d -p 53:53/udp -p 80:80 --add-host defaultweb.dnsserver.lan: --hostname dnsserver --name dnsserver dnsserver

Then connecting it to an existing docker network with

docker network connect --ip container_network dnsserver

I can access Apache2 just fine from another machine using the host machines IP ( and added the same IP as the Primary DNS on the machine I’m testing from. I can also access the DNS name from inside of the container

> ping defaultweb.dnsserver.lan
PING defaultweb.dnsserver.lan ( 56(84) bytes of data.
64 bytes from defaultweb.dnsserver.lan ( icmp_seq=1 ttl=64 time=0.029 ms

When I try to access Apache2 from another machine with the DNS name though (defaultweb.dnsserver.lan) it fails with the following message

> ping defaultweb.dnsserver.lan
Pinging defaultweb.dnsserver.lan [] with 32 bytes of data:
Reply from Destination host unreachable.

But it is recognizing the IP as

Any assistance with this would be a huge help!