# docker dns Server

{% embed url="<https://hub.docker.com/r/sameersbn/bind/>" %}

{% embed url="<https://github.com/sameersbn/docker-bind>" %}

### Dockerfile

```
FROM ubuntu:bionic-20190612 AS add-apt-repositories

RUN apt-get update \
 && DEBIAN_FRONTEND=noninteractive apt-get install -y gnupg \
 && apt-key adv --fetch-keys http://www.webmin.com/jcameron-key.asc \
 && echo "deb http://download.webmin.com/download/repository sarge contrib" >> /etc/apt/sources.list

FROM ubuntu:bionic-20190612

LABEL maintainer="sameer@damagehead.com"

ENV BIND_USER=bind \
    BIND_VERSION=9.11.3 \
    WEBMIN_VERSION=1.9 \
    DATA_DIR=/data

COPY --from=add-apt-repositories /etc/apt/trusted.gpg /etc/apt/trusted.gpg

COPY --from=add-apt-repositories /etc/apt/sources.list /etc/apt/sources.list

RUN rm -rf /etc/apt/apt.conf.d/docker-gzip-indexes \
 && apt-get update \
 && DEBIAN_FRONTEND=noninteractive apt-get install -y \
      bind9=1:${BIND_VERSION}* bind9-host=1:${BIND_VERSION}* dnsutils \
      webmin=${WEBMIN_VERSION}* \
 && rm -rf /var/lib/apt/lists/*

COPY entrypoint.sh /sbin/entrypoint.sh

RUN chmod 755 /sbin/entrypoint.sh

EXPOSE 53/udp 53/tcp 10000/tcp

ENTRYPOINT ["/sbin/entrypoint.sh"]

CMD ["/usr/sbin/named"]
```

```
#To deactivate the libvirt network named default:

virsh net-destroy default

#To prevent the network from automatically starting on boot:

virsh net-autostart --network default --disable

#To activate the network after it has been deactivated:
virsh net-start default
```

```
docker run --name='bind' -d -p 53:53/udp -p 10000:10000 -v /docker/dns/data:/data sameersbn/bind:latest
```

### 進入 bind 容器 docker exec -i -t bind bash

### 檢查 bind  語法 named-checkconf

### 重啟bind rndc reload

## 使用webmin

htpps\://localhost:10000 => root:password

tree /docker/dns

```
/docker/dns
└── data
    ├── bind
    │   ├── etc
    │   │   ├── bind.keys
    │   │   ├── db.0
    │   │   ├── db.127
    │   │   ├── db.255
    │   │   ├── db.empty
    │   │   ├── db.local
    │   │   ├── db.root
    │   │   ├── named.conf
    │   │   ├── named.conf.default-zones
    │   │   ├── named.conf.local
    │   │   ├── named.conf.options
    │   │   ├── rndc.key
    │   │   └── zones.rfc1918
    │   └── lib
    └── webmin
        └── etc
            ├── acl
            │   └── config
            ├── adsl-client
            │   └── config
            ├── ajaxterm
            │   └── config
            ├── apache
            │   └── config
            ├── at
            │   └── config
            ├── authentic-theme
            ├── backup-config
            │   └── config
            ├── bacula-backup
            │   └── config
            ├── bandwidth
            │   └── config
            ├── bind8
            │   ├── config
            │   └── zone-names
            ├── burner
            │   └── config
            ├── change-user
            │   └── config
            ├── cluster-copy
            │   └── config
            ├── cluster-cron
            │   └── config
            ├── cluster-passwd
            │   └── config
            ├── cluster-shell
            │   └── config
            ├── cluster-software
            │   └── config
            ├── cluster-useradmin
            │   └── config
            ├── cluster-usermin
            │   └── config
            ├── cluster-webmin
            │   └── config
            ├── config
            ├── cpan
            │   └── config
            ├── cron
            │   └── config
            ├── custom
            │   └── config
            ├── dfsadmin
            │   └── config
            ├── dhcpd
            │   └── config
            ├── dovecot
            │   └── config
            ├── exim
            │   └── config
            ├── exports
            │   └── config
            ├── fail2ban
            │   └── config
            ├── failed.pl
            ├── fdisk
            │   └── config
            ├── fetchmail
            │   └── config
            ├── filemin
            │   └── config
            ├── filter
            │   └── config
            ├── firewall
            │   └── config
            ├── firewall6
            │   └── config
            ├── firewalld
            │   └── config
            ├── first-install
            ├── fsdump
            │   └── config
            ├── grub
            │   └── config
            ├── heartbeat
            │   └── config
            ├── htaccess-htpasswd
            │   └── config
            ├── idmapd
            │   └── config
            ├── inetd
            │   └── config
            ├── init
            │   └── config
            ├── inittab
            │   └── config
            ├── installed.cache
            ├── ipfilter
            │   └── config
            ├── ipfw
            │   └── config
            ├── ipsec
            │   └── config
            ├── iscsi-client
            │   └── config
            ├── iscsi-server
            │   └── config
            ├── iscsi-target
            │   └── config
            ├── iscsi-tgtd
            │   └── config
            ├── jabber
            │   └── config
            ├── krb5
            │   └── config
            ├── ldap-client
            │   └── config
            ├── ldap-server
            │   └── config
            ├── ldap-useradmin
            │   └── config
            ├── login.pl
            ├── logout.pl
            ├── logrotate
            │   └── config
            ├── lpadmin
            │   └── config
            ├── lvm
            │   └── config
            ├── mailboxes
            │   └── config
            ├── mailcap
            │   └── config
            ├── man
            │   └── config
            ├── miniserv.conf
            ├── miniserv.pem
            ├── miniserv.users
            ├── mon
            │   └── config
            ├── mount
            │   └── config
            ├── mysql
            │   └── config
            ├── net
            │   └── config
            ├── nis
            │   └── config
            ├── openslp
            │   └── config
            ├── package-updates
            │   └── config
            ├── pam
            │   └── config
            ├── pap
            │   └── config
            ├── passwd
            │   └── config
            ├── perl-path
            ├── phpini
            │   └── config
            ├── postfix
            │   ├── config
            │   └── version
            ├── postgresql
            │   └── config
            ├── ppp-client
            │   └── config
            ├── pptp-client
            │   └── config
            ├── pptp-server
            │   └── config
            ├── proc
            │   └── config
            ├── procmail
            │   └── config
            ├── proftpd
            │   └── config
            ├── qmailadmin
            │   └── config
            ├── quota
            │   └── config
            ├── raid
            │   └── config
            ├── reload
            ├── restart
            ├── samba
            │   └── config
            ├── sarg
            │   └── config
            ├── sendmail
            │   └── config
            ├── servers
            │   └── config
            ├── shell
            │   └── config
            ├── shorewall
            │   └── config
            ├── shorewall6
            │   └── config
            ├── smart-status
            │   └── config
            ├── smf
            │   └── config
            ├── software
            │   └── config
            ├── spam
            │   └── config
            ├── squid
            │   └── config
            ├── sshd
            │   └── config
            ├── start
            ├── status
            │   └── config
            ├── stop
            ├── stunnel
            │   └── config
            ├── syslog
            │   └── config
            ├── syslog-ng
            │   └── config
            ├── system-status
            │   ├── config
            │   └── enable-collection.pl
            ├── tcpwrappers
            │   └── config
            ├── telnet
            │   └── config
            ├── time
            │   └── config
            ├── tunnel
            │   └── config
            ├── uninstall.sh
            ├── updown
            │   └── config
            ├── useradmin
            │   └── config
            ├── usermin
            │   └── config
            ├── var-path
            ├── version
            ├── vgetty
            │   └── config
            ├── webalizer
            │   └── config
            ├── webmin
            │   └── config
            ├── webmin.acl
            ├── webmincron
            │   ├── config
            │   └── crons
            │       ├── 15623863931623.cron
            │       └── 15623864562065.cron
            ├── webminlog
            │   └── config
            ├── wuftpd
            │   └── config
            └── xinetd
                └── config

```


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://kawsing.gitbook.io/opensystem/docker-cong-an-zhuang-dao-ying-yong-ru-men-pian/docker-dns-server.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
